9172022-01-27 20:12:21tomi7Áruszállítás (75 pont)cpp11Accepted 75/7570ms16040 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
   int n, m;
   cin>>n>>m;
   vector<pair<int, int>> a(m);
   for(int i=0;i<m;i++){
       cin>>a[i].first>>a[i].second;
   }
   int vegigmenes=0;
   int valasz=0;
   bool b=false;
   vector<int> c(n);
   for(int i=0;i<m;i++){
       c[a[i].first-1]++;
       c[a[i].second-1]--;
   }
   //for(int i=0;i<n;i++){
    //   cerr<<c[i]<<' ';
  // }
   for(int i=0;i<n-1;i++){
       vegigmenes+=c[i];
       if(vegigmenes==0){
           valasz++;
       }
   }
   cout<<valasz<<'\n';
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1740 KiB
2Accepted0/070ms12496 KiB
3Accepted3/32ms3292 KiB
4Accepted3/31ms3296 KiB
5Accepted3/31ms3296 KiB
6Accepted3/31ms3300 KiB
7Accepted3/31ms3312 KiB
8Accepted4/41ms3304 KiB
9Accepted4/41ms3312 KiB
10Accepted4/41ms3320 KiB
11Accepted4/41ms3536 KiB
12Accepted4/42ms3932 KiB
13Accepted4/44ms4068 KiB
14Accepted4/47ms4788 KiB
15Accepted4/44ms4904 KiB
16Accepted4/47ms6004 KiB
17Accepted4/48ms6756 KiB
18Accepted4/48ms7780 KiB
19Accepted4/47ms6992 KiB
20Accepted4/48ms8148 KiB
21Accepted4/464ms14648 KiB
22Accepted4/470ms16040 KiB