#include <bits/stdc++.h>
using namespace std;
#define int long long
int const N=2e5+5;
int const mod=1e9+7;
signed main(){
int n,a,b;
cin>>n>>a>>b;
set<pair<int,int>> st;
for(int i=0;i<n;i++){
int l,r;
cin>>l>>r;
for(int t=l;t<=r;t++){
int x=(t+(t/b))%a;
int y=t%b;
st.insert(make_pair(x,y));
}
}
cout<<st.size()<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
32 ms |
12668 KB |
Output is correct |
3 |
Correct |
54 ms |
18204 KB |
Output is correct |
4 |
Correct |
2 ms |
912 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
1116 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
27 ms |
7004 KB |
Output is correct |
16 |
Correct |
24 ms |
7248 KB |
Output is correct |
17 |
Correct |
88 ms |
8784 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1526 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
87 ms |
32368 KB |
Output is correct |
3 |
Correct |
95 ms |
32080 KB |
Output is correct |
4 |
Correct |
71 ms |
30544 KB |
Output is correct |
5 |
Execution timed out |
5068 ms |
62616 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
920 ms |
82148 KB |
Output is correct |
3 |
Runtime error |
1188 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
920 ms |
82148 KB |
Output is correct |
3 |
Runtime error |
1188 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
920 ms |
82148 KB |
Output is correct |
3 |
Runtime error |
1188 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
916 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
32 ms |
12668 KB |
Output is correct |
3 |
Correct |
54 ms |
18204 KB |
Output is correct |
4 |
Correct |
2 ms |
912 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
1116 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
27 ms |
7004 KB |
Output is correct |
16 |
Correct |
24 ms |
7248 KB |
Output is correct |
17 |
Correct |
88 ms |
8784 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Runtime error |
1526 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |