fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6.  
  7. int n,Q,p;
  8. cin>>n>>Q>>p;
  9.  
  10. int b[100000]={0};
  11. for(int i=1;i<=Q;i++){
  12. int l,r;
  13. cin>>l>>r;
  14.  
  15. b[l]=b[l]+1;
  16. if(r+1<=n){
  17. b[r+1]=b[r+1]-1;
  18.  
  19. }
  20. }
  21.  
  22. for(int i=1;i<=n;i++){
  23. b[i]=b[i]+b[i-1];
  24.  
  25. }
  26.  
  27. for(int i=1;i<=p;i++){
  28. int y;
  29. cin>>y;
  30. cout<<b[y]<<endl;
  31.  
  32. }
  33. return 0;
  34. }
Success #stdin #stdout 0s 5324KB
stdin
15 3 6 
1 7 
5 11
7 9 
7 1 5 10 9 15 
stdout
3
1
2
1
2
0