#include <iostream>
#include <set>
//#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pll;
ll N,A,B;
ll L[1000006],R[1000006];
ll x,y;
set<pll> S;
ll G;
ll ans;
ll P[1000006];
bool is_in(ll x){
return P[x];
}
int main(){
cin>>N>>A>>B;
ll M=(A*B);
for(int i=0;i<N;i++){
cin>>L[i]>>R[i];
x=L[i]%M;
y=R[i]%M;
if(y<x){
if(R[i]-L[i]>=M)
S.insert({0,M-1});
else{
S.insert({0,y});
S.insert({x,M-1});
}
}
else
S.insert({x,y});
}
for(pll p:S){
P[p.first]++;
P[p.second+1]--;
}
for(int i=1;i<M;i++)
P[i]+=P[i-1];
for(ll t=0;t<M;t++)
if(is_in(t))
ans++;
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
37 ms |
4000 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
4 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
15 ms |
8100 KB |
Output is correct |
3 |
Correct |
17 ms |
8056 KB |
Output is correct |
4 |
Correct |
14 ms |
6780 KB |
Output is correct |
5 |
Correct |
1853 ms |
24060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
3040 ms |
175420 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
3040 ms |
175420 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
3040 ms |
175420 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
303 ms |
17120 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
37 ms |
4000 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |