Max_Leb

Untitled

Jan 29th, 2022
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #define SIZE 10000
  3.  
  4.  
  5. int main() {
  6. int L, N, M;
  7. std::cin >> L >> N >> M;
  8. int result[SIZE];
  9. for (int i = 0; i < SIZE; ++i){
  10. result[i] = 0;
  11. }
  12.  
  13. int left, right;
  14. while (N){
  15. std::cin >> left;
  16. std::cin >> right;
  17. ++result[left - 1];
  18. --result[right];
  19. --N;
  20. }
  21.  
  22. int M_point = 0;
  23. for(int i = 0; i < SIZE; ++i){
  24. M_point += result[i];
  25. result[i] = M_point;
  26. }
  27.  
  28. for(int i = 0; i < M; i++){
  29. std::cin >> M_point;
  30. std::cout << result[M_point-1] << std::endl;
  31. }
  32.  
  33. return 0;
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment