Submission #563518

# Submission time Handle Problem Language Result Execution time Memory
563518 2022-05-17T11:43:48 Z Kanten4205 Strange Device (APIO19_strange_device) C++17
10 / 100
1288 ms 32236 KB
#include <bits/stdc++.h>
using namespace std;
const long long MOD1 = 1000000007;
const long long MOD2 = 998244353;
typedef long long ll;
typedef pair<ll, ll> P;
const long long INF = 1e17;
void solve() {
    ll N, A, B; cin >> N >> A >> B;
    vector<P>T(N);
    ll sum = 0;
    for (ll i = 0; i < N; i++) {
        cin >> T[i].first >> T[i].second;
        sum += T[i].second - T[i].first + 1;
    }
    if (sum <= 1000000) {
        //subtask 1
        set<P>S;
        for (ll i = 0; i < N; i++) {
            for (ll j = T[i].first; j <= T[i].second; j++) {
                P a = make_pair((j + j / B) % A, j % B);
                S.insert(a);
            }
        }
        cout << S.size() << endl;
    }
}
int main() {
    ll T = 1; //cin >> T;
    for (ll i = 0; i < T; i++) {
        //cout << "Case #" << i + 1 << ": ";
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 50 ms 12736 KB Output is correct
3 Correct 72 ms 18444 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 9 ms 1108 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 36 ms 6988 KB Output is correct
16 Correct 33 ms 7228 KB Output is correct
17 Correct 149 ms 11824 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 128 ms 32236 KB Output is correct
3 Correct 161 ms 31968 KB Output is correct
4 Correct 108 ms 30528 KB Output is correct
5 Incorrect 892 ms 22704 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1288 ms 28696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1288 ms 28696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1288 ms 28696 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 143 ms 5560 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 50 ms 12736 KB Output is correct
3 Correct 72 ms 18444 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 428 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 9 ms 1108 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 36 ms 6988 KB Output is correct
16 Correct 33 ms 7228 KB Output is correct
17 Correct 149 ms 11824 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Incorrect 0 ms 212 KB Output isn't correct
21 Halted 0 ms 0 KB -