#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define trace(a) cerr << #a << " = " << a << '\n'
#define ll long long
#define ld long double
#define int long long
#define pii pair<int, int>
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, a, b;
cin >> n >> a >> b;
int p = a / __gcd(a, b + 1);
set<pair<int, int>> s;
while (n--) {
int l, r;
cin >> l >> r;
for (int i = l; i <= r; i++) s.insert({i / b % p, i % b});
}
cout << sz(s);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
58 ms |
12536 KB |
Output is correct |
3 |
Correct |
79 ms |
18296 KB |
Output is correct |
4 |
Correct |
6 ms |
836 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
11 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 |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
256 KB |
Output is correct |
15 |
Correct |
42 ms |
7032 KB |
Output is correct |
16 |
Correct |
32 ms |
7168 KB |
Output is correct |
17 |
Correct |
73 ms |
10364 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Runtime error |
2474 ms |
524288 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
129 ms |
32376 KB |
Output is correct |
3 |
Correct |
123 ms |
32120 KB |
Output is correct |
4 |
Correct |
143 ms |
30712 KB |
Output is correct |
5 |
Execution timed out |
5078 ms |
62584 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
698 ms |
64500 KB |
Output is correct |
3 |
Runtime error |
1902 ms |
524288 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
698 ms |
64500 KB |
Output is correct |
3 |
Runtime error |
1902 ms |
524288 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
698 ms |
64500 KB |
Output is correct |
3 |
Runtime error |
1902 ms |
524288 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 |
5 ms |
384 KB |
Output is correct |
2 |
Runtime error |
1886 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 |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
58 ms |
12536 KB |
Output is correct |
3 |
Correct |
79 ms |
18296 KB |
Output is correct |
4 |
Correct |
6 ms |
836 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
6 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
512 KB |
Output is correct |
9 |
Correct |
11 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 |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
256 KB |
Output is correct |
15 |
Correct |
42 ms |
7032 KB |
Output is correct |
16 |
Correct |
32 ms |
7168 KB |
Output is correct |
17 |
Correct |
73 ms |
10364 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Runtime error |
2474 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
21 |
Halted |
0 ms |
0 KB |
- |