124332024-12-17 19:06:00szabelrÁruszállítás üres szakaszaicpp17Time limit exceeded 41/50398ms1524 KiB
#include <iostream>

using namespace std;
bool aru[1000001]{ 0 };

int main()
{
    long long n, m, db = 0;
    cin >> n >> m;
    int x, y;
    aru[n ] = 1;
    for (int i = 1; i <= m; i++) {
        cin >> x >> y;
        for (int z = x; z < y; z++) {
            aru[z] = 1;
        }
    }
    for (int i = 1; i <= n; i++) {
        if (aru[i] == 0 and aru[i + 1] != 0) {
            db++;
        }



    }
    cout << db;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base41/50
1Accepted0/01ms320 KiB
2Accepted0/079ms1336 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms508 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted2/21ms320 KiB
8Accepted2/21ms320 KiB
9Accepted2/21ms552 KiB
10Accepted2/21ms320 KiB
11Accepted2/21ms320 KiB
12Accepted2/21ms320 KiB
13Accepted3/34ms504 KiB
14Accepted3/37ms584 KiB
15Accepted3/34ms588 KiB
16Time limit exceeded0/3395ms1524 KiB
17Time limit exceeded0/3372ms1264 KiB
18Time limit exceeded0/3398ms1040 KiB
19Accepted3/38ms568 KiB
20Accepted3/38ms824 KiB
21Accepted3/370ms1336 KiB
22Accepted3/372ms1336 KiB