#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;
int N, A, B;
set<pii> st;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> N >> A >> B;
for (int i = 1; i <= N; i++)
{
ll l, r;
cin >> l >> r;
for (ll i = l; i <= r; i++)
st.insert(pll((i + i/B) % A, i % B));
}
cout << st.size() << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
50 ms |
9324 KB |
Output is correct |
3 |
Correct |
57 ms |
13404 KB |
Output is correct |
4 |
Correct |
2 ms |
724 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
10 ms |
980 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 |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
35 ms |
5264 KB |
Output is correct |
16 |
Correct |
23 ms |
5056 KB |
Output is correct |
17 |
Correct |
53 ms |
4960 KB |
Output is correct |
18 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
3989 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
118 ms |
24224 KB |
Output is correct |
3 |
Correct |
148 ms |
24004 KB |
Output is correct |
4 |
Correct |
115 ms |
23016 KB |
Output is correct |
5 |
Execution timed out |
5022 ms |
46908 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
576 ms |
47168 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
576 ms |
47168 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
576 ms |
47168 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1875 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
50 ms |
9324 KB |
Output is correct |
3 |
Correct |
57 ms |
13404 KB |
Output is correct |
4 |
Correct |
2 ms |
724 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
10 ms |
980 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 |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
35 ms |
5264 KB |
Output is correct |
16 |
Correct |
23 ms |
5056 KB |
Output is correct |
17 |
Correct |
53 ms |
4960 KB |
Output is correct |
18 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
19 |
Halted |
0 ms |
0 KB |
- |