#include <bits/stdc++.h>
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define fastInp ios_base::sync_with_stdio(0); cin.tie(0);
#define pii pair<int, int>
#define fr first
#define sc second
#define int long long
using namespace std;
const int MAXN = (int)1e6 + 6;
signed main() {
fastInp;
int n, a, b;
cin >> n >> a >> b;
set <pii> st;
for (int i = 1; i <= n; i++) {
int l, r;
cin >> l >> r;
for (int t = l; t <= r; t++) {
st.insert({(t + (t / b)) % a, t % b});
}
}
cout << szof(st) << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
49 ms |
12652 KB |
Output is correct |
3 |
Correct |
72 ms |
17900 KB |
Output is correct |
4 |
Correct |
3 ms |
876 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
392 KB |
Output is correct |
7 |
Correct |
2 ms |
492 KB |
Output is correct |
8 |
Correct |
2 ms |
492 KB |
Output is correct |
9 |
Correct |
9 ms |
1260 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
368 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
43 ms |
7020 KB |
Output is correct |
16 |
Correct |
31 ms |
7112 KB |
Output is correct |
17 |
Correct |
64 ms |
7404 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Runtime error |
2510 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
134 ms |
32364 KB |
Output is correct |
3 |
Correct |
188 ms |
32108 KB |
Output is correct |
4 |
Correct |
124 ms |
30700 KB |
Output is correct |
5 |
Execution timed out |
5086 ms |
62572 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
611 ms |
65492 KB |
Output is correct |
3 |
Runtime error |
2044 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
611 ms |
65492 KB |
Output is correct |
3 |
Runtime error |
2044 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
611 ms |
65492 KB |
Output is correct |
3 |
Runtime error |
2044 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Runtime error |
1647 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
49 ms |
12652 KB |
Output is correct |
3 |
Correct |
72 ms |
17900 KB |
Output is correct |
4 |
Correct |
3 ms |
876 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
392 KB |
Output is correct |
7 |
Correct |
2 ms |
492 KB |
Output is correct |
8 |
Correct |
2 ms |
492 KB |
Output is correct |
9 |
Correct |
9 ms |
1260 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
11 |
Correct |
1 ms |
364 KB |
Output is correct |
12 |
Correct |
1 ms |
368 KB |
Output is correct |
13 |
Correct |
1 ms |
364 KB |
Output is correct |
14 |
Correct |
1 ms |
364 KB |
Output is correct |
15 |
Correct |
43 ms |
7020 KB |
Output is correct |
16 |
Correct |
31 ms |
7112 KB |
Output is correct |
17 |
Correct |
64 ms |
7404 KB |
Output is correct |
18 |
Correct |
1 ms |
364 KB |
Output is correct |
19 |
Correct |
1 ms |
364 KB |
Output is correct |
20 |
Runtime error |
2510 ms |
524292 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |