fork download
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define fo(i,start,end) for(int i=start;i<end;i++)
  4. using namespace std;
  5.  
  6. int main() {
  7. // your code goes here
  8. int n;
  9. cin>>n;
  10. vector<int>arr(n+1,0);
  11. int q;
  12. cin>>q;
  13. while(q--){
  14. int l,r;
  15. cin>>l>>r;
  16. fo(i,l,r+1){
  17. arr[i]++;
  18. }
  19. }
  20. fo(i,1,n){
  21. cout<<arr[i]<<" ";
  22. }
  23. cout<<endl;
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 5288KB
stdin
10
2
3 5 
4 7

stdout
0 0 1 2 2 1 1 0 0