fork(1) download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7. // your code goes here
  8. int n,q ; cin>>n>>q;
  9. vector<int>arr(n+1,0);
  10. for(int i = 1 ; i<=q;i++){
  11. int l,r; cin>>l>>r;
  12. for(int j = l ; j<=r;j++){
  13. arr[j]++;
  14. }
  15. }
  16. for(int i =1; i<=n;i++) cout<<arr[i];
  17.  
  18.  
  19.  
  20. }
Success #stdin #stdout 0.01s 5324KB
stdin
5 3
1 5
2 4
3 5
stdout
12332