#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
ll n,a,b;cin>>n>>a>>b;
bool vis[b][10000];
ll ans=0;
for(int j=1;j<=n;j++){
ll x,y;cin>>x>>y;
for(ll i=x;i<=y;i++){
ll c=(i+i/b)%a;
ll d=i%b;
if(!vis[d][c]){
ans++;
vis[d][c]=true;
}
}
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
26 ms |
29880 KB |
Output is correct |
3 |
Correct |
47 ms |
93348 KB |
Output is correct |
4 |
Correct |
4 ms |
8916 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1108 KB |
Output is correct |
7 |
Correct |
1 ms |
2748 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
1492 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
468 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Correct |
11 ms |
9360 KB |
Output is correct |
16 |
Correct |
13 ms |
2600 KB |
Output is correct |
17 |
Correct |
122 ms |
83540 KB |
Output is correct |
18 |
Runtime error |
180 ms |
524288 KB |
Execution killed with signal 9 |
19 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
157 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 |
Runtime error |
2 ms |
1876 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
166 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 |
26 ms |
29880 KB |
Output is correct |
3 |
Correct |
47 ms |
93348 KB |
Output is correct |
4 |
Correct |
4 ms |
8916 KB |
Output is correct |
5 |
Correct |
1 ms |
1236 KB |
Output is correct |
6 |
Correct |
1 ms |
1108 KB |
Output is correct |
7 |
Correct |
1 ms |
2748 KB |
Output is correct |
8 |
Correct |
1 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
1492 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
468 KB |
Output is correct |
13 |
Correct |
1 ms |
468 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Correct |
11 ms |
9360 KB |
Output is correct |
16 |
Correct |
13 ms |
2600 KB |
Output is correct |
17 |
Correct |
122 ms |
83540 KB |
Output is correct |
18 |
Runtime error |
180 ms |
524288 KB |
Execution killed with signal 9 |
19 |
Halted |
0 ms |
0 KB |
- |