#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(pii((i + i/B) % A, i % B));
}
cout << st.size() << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
43 ms |
9516 KB |
Output is correct |
3 |
Correct |
58 ms |
13808 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 |
324 KB |
Output is correct |
9 |
Correct |
7 ms |
988 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
320 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 |
39 ms |
5268 KB |
Output is correct |
16 |
Correct |
22 ms |
5452 KB |
Output is correct |
17 |
Correct |
57 ms |
6420 KB |
Output is correct |
18 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
19 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
3416 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
119 ms |
24208 KB |
Output is correct |
3 |
Correct |
140 ms |
24156 KB |
Output is correct |
4 |
Correct |
100 ms |
22996 KB |
Output is correct |
5 |
Execution timed out |
5030 ms |
47036 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
464 ms |
47788 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
464 ms |
47788 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
336 KB |
Output is correct |
2 |
Correct |
464 ms |
47788 KB |
Output is correct |
3 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1653 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
43 ms |
9516 KB |
Output is correct |
3 |
Correct |
58 ms |
13808 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 |
324 KB |
Output is correct |
9 |
Correct |
7 ms |
988 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
320 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 |
39 ms |
5268 KB |
Output is correct |
16 |
Correct |
22 ms |
5452 KB |
Output is correct |
17 |
Correct |
57 ms |
6420 KB |
Output is correct |
18 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 8 |
19 |
Halted |
0 ms |
0 KB |
- |