Submission #741573

# Submission time Handle Problem Language Result Execution time Memory
741573 2023-05-14T10:52:50 Z yeyso Strange Device (APIO19_strange_device) C++14
10 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, a, b; cin >> n >> a >> b;
    vector<pair<long long, long long>> periods;
    long long l, r;
    long long time = 0;
    for(long long i = 0; i < n; i ++){
        cin >> l >> r;
        periods.push_back({l, r});
    }
    time = periods[periods.size()-1].second;
    set<pair<long long, long long>> res;
    long long x, y;
    for(long long i = 0; i < n; i ++){
        for(long long t = periods[i].first; t <= periods[i].second; t ++){
            x = (t + (t/b)) % a;
            y = t % b;
            res.insert({x, y});
        }
    }
    cout << res.size();
}
/*
g++ -std=gnu++17 -O2 -pipe -static -o device device.cpp
3 3 3
4 4
7 9
17 18
*/

Compilation message

strange_device.cpp: In function 'int main()':
strange_device.cpp:7:15: warning: variable 'time' set but not used [-Wunused-but-set-variable]
    7 |     long long time = 0;
      |               ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 51 ms 12816 KB Output is correct
3 Correct 69 ms 18424 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 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 1 ms 212 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 7016 KB Output is correct
16 Correct 33 ms 7240 KB Output is correct
17 Correct 143 ms 12000 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 2870 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 127 ms 32312 KB Output is correct
3 Correct 141 ms 32136 KB Output is correct
4 Correct 111 ms 30588 KB Output is correct
5 Execution timed out 5054 ms 78400 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1371 ms 79108 KB Output is correct
3 Runtime error 2804 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1371 ms 79108 KB Output is correct
3 Runtime error 2804 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1371 ms 79108 KB Output is correct
3 Runtime error 2804 ms 524288 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 304 KB Output is correct
2 Runtime error 1417 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 51 ms 12816 KB Output is correct
3 Correct 69 ms 18424 KB Output is correct
4 Correct 2 ms 852 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 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 1 ms 212 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 7016 KB Output is correct
16 Correct 33 ms 7240 KB Output is correct
17 Correct 143 ms 12000 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Runtime error 2870 ms 524288 KB Execution killed with signal 9
21 Halted 0 ms 0 KB -