#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const signed M = 1e4, MOD = 998244353;
int f[M], l[M];
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n, a, b;
cin >> n >> a >> b;
set<pair<int, int>> st;
for (int i = 0; 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 << st.size() << endl;
return 0;
}
/*
3 3 3
4 4
7 9
17 18
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
49 ms |
12712 KB |
Output is correct |
3 |
Correct |
72 ms |
18308 KB |
Output is correct |
4 |
Correct |
2 ms |
836 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 |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
7 ms |
1108 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
228 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
36 ms |
7040 KB |
Output is correct |
16 |
Correct |
27 ms |
7108 KB |
Output is correct |
17 |
Correct |
61 ms |
10316 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
324 KB |
Output is correct |
2 |
Runtime error |
3172 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
123 ms |
32308 KB |
Output is correct |
3 |
Correct |
163 ms |
32160 KB |
Output is correct |
4 |
Correct |
110 ms |
30684 KB |
Output is correct |
5 |
Execution timed out |
5087 ms |
62572 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
546 ms |
79688 KB |
Output is correct |
3 |
Runtime error |
1757 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
546 ms |
79688 KB |
Output is correct |
3 |
Runtime error |
1757 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
546 ms |
79688 KB |
Output is correct |
3 |
Runtime error |
1757 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1335 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
49 ms |
12712 KB |
Output is correct |
3 |
Correct |
72 ms |
18308 KB |
Output is correct |
4 |
Correct |
2 ms |
836 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 |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
7 ms |
1108 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
228 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
36 ms |
7040 KB |
Output is correct |
16 |
Correct |
27 ms |
7108 KB |
Output is correct |
17 |
Correct |
61 ms |
10316 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
324 KB |
Output is correct |
20 |
Runtime error |
3172 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |