74902024-01-09 10:34:36madvirÁruszállítás üres szakaszaicpp17Wrong answer 14/50400ms12232 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, m, fel, le, card=0;
    cin >> n >> m;
    int ut[n+1]={0};
    for(int i=1; i<=m; i++) {
        cin >> fel >> le;
        for(int megy=fel; megy<le; megy++) {
            ut[megy]++;
        }
    }
    int tart=1;
    while(tart<n) {
        while(ut[tart]>0 && tart<n) {
            tart++;
        }
        if(ut[tart]==0) {
            card++;
            while(ut[tart]==0 && tart<n) {
                tart++;
            }
        }
    }

    cout << card;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base14/50
1Accepted0/03ms1872 KiB
2Wrong answer0/086ms9996 KiB
3Accepted2/23ms2368 KiB
4Wrong answer0/23ms2480 KiB
5Accepted2/23ms2680 KiB
6Accepted2/23ms2920 KiB
7Accepted2/23ms3108 KiB
8Accepted2/23ms3256 KiB
9Wrong answer0/23ms3468 KiB
10Wrong answer0/23ms3684 KiB
11Accepted2/23ms4092 KiB
12Accepted2/23ms4364 KiB
13Wrong answer0/37ms4628 KiB
14Wrong answer0/38ms5304 KiB
15Wrong answer0/37ms5312 KiB
16Time limit exceeded0/3400ms6944 KiB
17Time limit exceeded0/3361ms7388 KiB
18Time limit exceeded0/3381ms7500 KiB
19Wrong answer0/39ms7380 KiB
20Wrong answer0/312ms8124 KiB
21Wrong answer0/379ms12148 KiB
22Wrong answer0/381ms12232 KiB