#include <bits/stdc++.h>
#define SS ios_base::sync_with_stdio(0);cin.tie(nullptr);cout.tie(nullptr);
//#define int long long
#define all(x) x.begin(),x.end()
#define F first
#define S second
using namespace std;
const int N = 501,mx=1025;
const long double eps = 1e-9;
int inf = 1e9, MOD = 998244353;
vector<pair<int,int>> g[N];
signed main() {
SS
int n,a,b;
cin>>n>>a>>b;
pair<int,int> p[n+1];
set<pair<int,int>> st;
for(int i=1;i<=n;i++){
cin>>p[i].F>>p[i].S;
}
for(auto [l,r]:p){
for(int i=l;i<=r;i++){
int x=(int)(i+floor((double)(i/b)))%a;
int y=i%b;
st.insert({x,y});
}
}
cout<<st.size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Runtime error |
2464 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
24 ms |
8296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
24 ms |
8296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
24 ms |
8296 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
4 ms |
1104 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |