fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <bits/stdc++.h>
  4. typedef long long int ll;
  5. int main() {
  6. // your code goes here
  7. ll n,q,m;
  8. cin>>n>>q>>m;
  9.  
  10. ll i,j;
  11. //ll lamps[n+1]={0};
  12. ll b[2000]={0};
  13. ll l,r;
  14. for(i=1;i<=q;i++)
  15. {
  16. // for(j=1;j<=col;j++)
  17. // {
  18. // cin>>lamps[i][j];
  19. // }
  20. cin>>l>>r;
  21. b[l]=b[l]+1;
  22. //if (r + 1 <= n) {
  23. // b[r+1]=b[r+1]-1;
  24. // }
  25. b[r+1]=b[r+1]-1;
  26.  
  27. }
  28.  
  29.  
  30. i=1;
  31. for(i=1;i<=n;i++)
  32. {
  33. b[i]=b[i-1]+b[i];
  34. }
  35.  
  36. i=1;
  37. ll y;
  38. for(i=1;i<=m;i++)
  39. {
  40. cin>>y;
  41. cout<<b[y]<<" ";
  42. }
  43. }
Success #stdin #stdout 0.01s 5288KB
stdin
15 3 6
1 7
5 11
7 9
7 1 5 10 9 15
stdout
3 1 2 1 2 0