답안 #1031703

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1031703 2024-07-23T04:48:14 Z stdfloat 이상한 기계 (APIO19_strange_device) C++17
5 / 100
3539 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n;
    ll A, B;
    cin >> n >> A >> B;

    int L = 0;
    set<pair<int, int>> s;
    for (int i = 1; ; i++) {
        int x = (i + i / B) % A, y = i % B;
        if (s.find({x, y}) != s.end()) {
            L = i - 1;
            break;
        }

        s.insert({x, y});
    }

    vector<int> p(L + 1);
    while (n--) {
        ll l, r;
        cin >> l >> r;

        if (L <= r - l + 1) {
            p[0]++;
            continue;
        }

        p[l % L]++; p[r % L + 1]--;

        if (l % L > r % L) p[0]++;
    }

    int cnt = 0;
    for (int i = 0; i < L; i++) {
        p[i] += p[i - 1];
        cnt += !!p[i];
    }

    cout << cnt << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1396 ms 329660 KB Output is correct
3 Correct 1004 ms 253040 KB Output is correct
4 Correct 3 ms 1112 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 1116 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 17 ms 6488 KB Output is correct
16 Correct 38 ms 10244 KB Output is correct
17 Correct 425 ms 104420 KB Output is correct
18 Runtime error 3254 ms 524288 KB Execution killed with signal 9
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 3539 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 177 ms 49320 KB Output is correct
3 Correct 185 ms 50004 KB Output is correct
4 Correct 154 ms 41604 KB Output is correct
5 Correct 332 ms 76372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 498 ms 96140 KB Output is correct
3 Runtime error 3359 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 498 ms 96140 KB Output is correct
3 Runtime error 3359 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 498 ms 96140 KB Output is correct
3 Runtime error 3359 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 1583 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1396 ms 329660 KB Output is correct
3 Correct 1004 ms 253040 KB Output is correct
4 Correct 3 ms 1112 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 2 ms 1116 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 17 ms 6488 KB Output is correct
16 Correct 38 ms 10244 KB Output is correct
17 Correct 425 ms 104420 KB Output is correct
18 Runtime error 3254 ms 524288 KB Execution killed with signal 9
19 Halted 0 ms 0 KB -