#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
const int INF=1e18;
int32_t main(){
int t;cin>>t;
int a,b;cin>>a>>b;
int m=0;
if(INF/a<b){
m=INF;
}
else{
m=a*b;
}
vector<int> v(m);
for(int i=0;i<t;i++){
int l,r;cin>>l>>r;
if(r-l+1>=m){
cout<<m<<endl;
return 0;
}
for(int j=l;j<=r;j++){
v[j%m]=1;
}
}
int ans=0;
for(int i=0;i<m;i++){
ans+=v[i];
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
38 ms |
51264 KB |
Output is correct |
3 |
Correct |
44 ms |
39468 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4052 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
300 KB |
Output is correct |
2 |
Runtime error |
209 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
13 ms |
7884 KB |
Output is correct |
3 |
Correct |
14 ms |
7984 KB |
Output is correct |
4 |
Correct |
12 ms |
6612 KB |
Output is correct |
5 |
Execution timed out |
5077 ms |
8148 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1351 ms |
38992 KB |
Output is correct |
3 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1351 ms |
38992 KB |
Output is correct |
3 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1351 ms |
38992 KB |
Output is correct |
3 |
Runtime error |
2 ms |
596 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
211 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
38 ms |
51264 KB |
Output is correct |
3 |
Correct |
44 ms |
39468 KB |
Output is correct |
4 |
Incorrect |
2 ms |
4052 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |