#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
ll n, a, b, l, r;
set<pll> st;
// vector<pll> tset;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n >> a >> b;
while(n--)
{
cin >> l >> r;
for (ll i = l; i <= r; ++i)
{
pll hasil = {(i + (i/b)) % a, i % b};
st.insert(hasil);
// tset.push_back(hasil);
}
}
// cout << "---\n";
// for (int i = 0; i < tset.size(); ++i)
// {
// cout << tset[i].first << " " << tset[i].second << "\n";
// }
// cout << "\n";
cout << st.size() << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
35 ms |
12332 KB |
Output is correct |
3 |
Correct |
54 ms |
18260 KB |
Output is correct |
4 |
Correct |
2 ms |
852 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
1172 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
30 ms |
7004 KB |
Output is correct |
16 |
Correct |
20 ms |
6692 KB |
Output is correct |
17 |
Correct |
41 ms |
6588 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
2304 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 |
109 ms |
32252 KB |
Output is correct |
3 |
Correct |
151 ms |
32100 KB |
Output is correct |
4 |
Correct |
103 ms |
30528 KB |
Output is correct |
5 |
Execution timed out |
5050 ms |
62480 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
419 ms |
62820 KB |
Output is correct |
3 |
Runtime error |
1317 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
419 ms |
62820 KB |
Output is correct |
3 |
Runtime error |
1317 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
419 ms |
62820 KB |
Output is correct |
3 |
Runtime error |
1317 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1221 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 |
35 ms |
12332 KB |
Output is correct |
3 |
Correct |
54 ms |
18260 KB |
Output is correct |
4 |
Correct |
2 ms |
852 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
1172 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
30 ms |
7004 KB |
Output is correct |
16 |
Correct |
20 ms |
6692 KB |
Output is correct |
17 |
Correct |
41 ms |
6588 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Runtime error |
2304 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |