#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
// Subtask 1
ll n,a,b; cin >> n >> a >> b;
vector<pair<ll,ll>> v(n);
for(int i=0;i<n;i++) cin >> v[i].first >> v[i].second;
set<pair<ll,ll>> s;
for(int i=0;i<n;i++){
for(ll t=v[i].first;t<=v[i].second;t++){
s.insert({(t+t/b)%a,t%b});
}
}
cout << s.size() << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
47 ms |
12760 KB |
Output is correct |
3 |
Correct |
70 ms |
18352 KB |
Output is correct |
4 |
Correct |
2 ms |
812 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
7 ms |
1200 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 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 |
34 ms |
6988 KB |
Output is correct |
16 |
Correct |
35 ms |
7244 KB |
Output is correct |
17 |
Correct |
142 ms |
11840 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Runtime error |
2760 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 |
121 ms |
32196 KB |
Output is correct |
3 |
Correct |
163 ms |
31968 KB |
Output is correct |
4 |
Correct |
102 ms |
30540 KB |
Output is correct |
5 |
Execution timed out |
5100 ms |
81300 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1664 ms |
84080 KB |
Output is correct |
3 |
Runtime error |
2807 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 |
1664 ms |
84080 KB |
Output is correct |
3 |
Runtime error |
2807 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 |
1664 ms |
84080 KB |
Output is correct |
3 |
Runtime error |
2807 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 |
1341 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 |
47 ms |
12760 KB |
Output is correct |
3 |
Correct |
70 ms |
18352 KB |
Output is correct |
4 |
Correct |
2 ms |
812 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
300 KB |
Output is correct |
7 |
Correct |
1 ms |
468 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
7 ms |
1200 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 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 |
34 ms |
6988 KB |
Output is correct |
16 |
Correct |
35 ms |
7244 KB |
Output is correct |
17 |
Correct |
142 ms |
11840 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
300 KB |
Output is correct |
20 |
Runtime error |
2760 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |