#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <functional>
//#include <unordered_map>
using namespace std;
template<typename T> void uin(T &a, T b) {if (b < a) a = b;}
template<typename T> void uax(T &a, T b) {if (b > a) a = b;}
#define int long long
#define double long double
#define left left228
#define right right228
#define mp make_pair
#define all(v) v.begin(), v.end()
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, A, B;
cin >> n >> A >> B;
set< pair<int,int> > s;
for (int i = 0; i < n; ++i) {
int l, r;
cin >> l >> r;
for (int t = l; t <= r; ++t) {
int x = (t + t / B) % A;
int y = t % B;
s.insert({x, y});
}
}
cout << s.size() << '\n';
return 0;
}
/*
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
45 ms |
12360 KB |
Output is correct |
3 |
Correct |
67 ms |
18296 KB |
Output is correct |
4 |
Correct |
2 ms |
896 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
8 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
39 ms |
7068 KB |
Output is correct |
16 |
Correct |
29 ms |
7188 KB |
Output is correct |
17 |
Correct |
69 ms |
10360 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Runtime error |
3314 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
127 ms |
32248 KB |
Output is correct |
3 |
Correct |
189 ms |
32224 KB |
Output is correct |
4 |
Correct |
118 ms |
30712 KB |
Output is correct |
5 |
Execution timed out |
5096 ms |
62584 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
623 ms |
62968 KB |
Output is correct |
3 |
Runtime error |
1982 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
623 ms |
62968 KB |
Output is correct |
3 |
Runtime error |
1982 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
623 ms |
62968 KB |
Output is correct |
3 |
Runtime error |
1982 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Runtime error |
1403 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
45 ms |
12360 KB |
Output is correct |
3 |
Correct |
67 ms |
18296 KB |
Output is correct |
4 |
Correct |
2 ms |
896 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
512 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
8 ms |
1280 KB |
Output is correct |
10 |
Correct |
0 ms |
384 KB |
Output is correct |
11 |
Correct |
0 ms |
384 KB |
Output is correct |
12 |
Correct |
0 ms |
384 KB |
Output is correct |
13 |
Correct |
0 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
39 ms |
7068 KB |
Output is correct |
16 |
Correct |
29 ms |
7188 KB |
Output is correct |
17 |
Correct |
69 ms |
10360 KB |
Output is correct |
18 |
Correct |
0 ms |
384 KB |
Output is correct |
19 |
Correct |
0 ms |
384 KB |
Output is correct |
20 |
Runtime error |
3314 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
21 |
Halted |
0 ms |
0 KB |
- |