#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
int n , a , b ;
cin>> n >>a>> b ;
int ans = 0 ;
map<pair<int,int>,int> occ ;
for(int i=0;i<n;i++){
int l ,r ;
cin>>l>>r ;
for(;l<=r;l++){
int x = l+l/b ;
x%=a ;
int y = l%b ;
// if(x>y) swap(x,y) ;
if(occ[{x,y}]) continue ;
ans++ ;
occ[{x,y}]=1 ;
}
}
cout << ans ;
return 0 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
93 ms |
12664 KB |
Output is correct |
3 |
Correct |
137 ms |
18424 KB |
Output is correct |
4 |
Correct |
3 ms |
896 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
10 ms |
1248 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
0 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
53 ms |
7032 KB |
Output is correct |
16 |
Correct |
67 ms |
7160 KB |
Output is correct |
17 |
Correct |
335 ms |
10276 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5091 ms |
521648 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
207 ms |
32464 KB |
Output is correct |
3 |
Correct |
226 ms |
32120 KB |
Output is correct |
4 |
Correct |
191 ms |
30584 KB |
Output is correct |
5 |
Execution timed out |
5060 ms |
62584 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
3353 ms |
81340 KB |
Output is correct |
3 |
Runtime error |
3594 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
3353 ms |
81340 KB |
Output is correct |
3 |
Runtime error |
3594 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
3353 ms |
81340 KB |
Output is correct |
3 |
Runtime error |
3594 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Runtime error |
2952 ms |
524292 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
93 ms |
12664 KB |
Output is correct |
3 |
Correct |
137 ms |
18424 KB |
Output is correct |
4 |
Correct |
3 ms |
896 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
10 ms |
1248 KB |
Output is correct |
10 |
Correct |
0 ms |
256 KB |
Output is correct |
11 |
Correct |
0 ms |
256 KB |
Output is correct |
12 |
Correct |
0 ms |
256 KB |
Output is correct |
13 |
Correct |
0 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
53 ms |
7032 KB |
Output is correct |
16 |
Correct |
67 ms |
7160 KB |
Output is correct |
17 |
Correct |
335 ms |
10276 KB |
Output is correct |
18 |
Correct |
0 ms |
256 KB |
Output is correct |
19 |
Correct |
0 ms |
256 KB |
Output is correct |
20 |
Execution timed out |
5091 ms |
521648 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |