#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n, a, b;
set<pair<ll,ll>> distinct;
int main() {
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin >> n >> a >> b;
for(int i = 0; i < n; i++) {
ll l, r; cin >> l >> r;
for(ll t = l; t <= r; t++)
distinct.insert({(t+t/b)%a, t%b});
}
cout << distinct.size() << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
51 ms |
12792 KB |
Output is correct |
3 |
Correct |
73 ms |
18296 KB |
Output is correct |
4 |
Correct |
6 ms |
896 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
47 ms |
7120 KB |
Output is correct |
16 |
Correct |
33 ms |
7168 KB |
Output is correct |
17 |
Correct |
76 ms |
10360 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Runtime error |
2816 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
133 ms |
32376 KB |
Output is correct |
3 |
Correct |
187 ms |
32120 KB |
Output is correct |
4 |
Correct |
122 ms |
30712 KB |
Output is correct |
5 |
Execution timed out |
5075 ms |
62584 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
635 ms |
100096 KB |
Output is correct |
3 |
Runtime error |
1964 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
635 ms |
100096 KB |
Output is correct |
3 |
Runtime error |
1964 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
635 ms |
100096 KB |
Output is correct |
3 |
Runtime error |
1964 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Runtime error |
1481 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
51 ms |
12792 KB |
Output is correct |
3 |
Correct |
73 ms |
18296 KB |
Output is correct |
4 |
Correct |
6 ms |
896 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
512 KB |
Output is correct |
8 |
Correct |
5 ms |
512 KB |
Output is correct |
9 |
Correct |
12 ms |
1280 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
47 ms |
7120 KB |
Output is correct |
16 |
Correct |
33 ms |
7168 KB |
Output is correct |
17 |
Correct |
76 ms |
10360 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Runtime error |
2816 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
21 |
Halted |
0 ms |
0 KB |
- |