#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
#define ll long long
set <pair <ll, ll>> s;
int main () {
ll A, B;
int n;
cin >> n >> A >> B;
for (int i = 1; i <= n; ++i) {
ll l, r;
cin >> l >> r;
for (ll j = l; j <= r; ++j) {
ll x = j + (j / B), y = j % B;
x %= A;
s.insert ({x, y});
}
}
cout << (int)s.size();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
41 ms |
12576 KB |
Output is correct |
3 |
Correct |
59 ms |
18260 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
480 KB |
Output is correct |
9 |
Correct |
7 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 |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
31 ms |
6996 KB |
Output is correct |
16 |
Correct |
28 ms |
7004 KB |
Output is correct |
17 |
Correct |
115 ms |
10256 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
2011 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
112 ms |
32384 KB |
Output is correct |
3 |
Correct |
152 ms |
32448 KB |
Output is correct |
4 |
Correct |
101 ms |
30548 KB |
Output is correct |
5 |
Execution timed out |
5043 ms |
62548 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1084 ms |
100048 KB |
Output is correct |
3 |
Runtime error |
1299 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1084 ms |
100048 KB |
Output is correct |
3 |
Runtime error |
1299 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1084 ms |
100048 KB |
Output is correct |
3 |
Runtime error |
1299 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
1346 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
41 ms |
12576 KB |
Output is correct |
3 |
Correct |
59 ms |
18260 KB |
Output is correct |
4 |
Correct |
2 ms |
860 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
480 KB |
Output is correct |
9 |
Correct |
7 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 |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
31 ms |
6996 KB |
Output is correct |
16 |
Correct |
28 ms |
7004 KB |
Output is correct |
17 |
Correct |
115 ms |
10256 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Runtime error |
2011 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |