#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl ;
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
const int MOD = 1000000007;
const int N = 1000005;
const double PI =4*atan(1);
const double eps = 1e-7;
ll n;
ll a,b;
set<pair<ll,ll> > ss;
int main(){
ios::sync_with_stdio(0);
//freopen("easy.txt","r",stdin);
cin >> n >> a >> b;
for(int i=0;i<n;i++){
ll x,y;
cin >> x >> y;
for(ll t=x;t<=y;t++){
ss.insert(mp((t+t/b)%a,t%b));
}
}
cout << ss.size() << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
76 ms |
12408 KB |
Output is correct |
3 |
Correct |
120 ms |
18296 KB |
Output is correct |
4 |
Correct |
4 ms |
888 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
504 KB |
Output is correct |
8 |
Correct |
3 ms |
504 KB |
Output is correct |
9 |
Correct |
12 ms |
1272 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
0 ms |
376 KB |
Output is correct |
15 |
Correct |
61 ms |
7032 KB |
Output is correct |
16 |
Correct |
44 ms |
7160 KB |
Output is correct |
17 |
Correct |
98 ms |
8824 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
4011 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
204 ms |
32248 KB |
Output is correct |
3 |
Correct |
225 ms |
32060 KB |
Output is correct |
4 |
Correct |
203 ms |
30632 KB |
Output is correct |
5 |
Execution timed out |
5009 ms |
62532 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
815 ms |
62896 KB |
Output is correct |
3 |
Runtime error |
2942 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
815 ms |
62896 KB |
Output is correct |
3 |
Runtime error |
2942 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
815 ms |
62896 KB |
Output is correct |
3 |
Runtime error |
2942 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Runtime error |
2056 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
76 ms |
12408 KB |
Output is correct |
3 |
Correct |
120 ms |
18296 KB |
Output is correct |
4 |
Correct |
4 ms |
888 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
3 ms |
504 KB |
Output is correct |
8 |
Correct |
3 ms |
504 KB |
Output is correct |
9 |
Correct |
12 ms |
1272 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
0 ms |
376 KB |
Output is correct |
15 |
Correct |
61 ms |
7032 KB |
Output is correct |
16 |
Correct |
44 ms |
7160 KB |
Output is correct |
17 |
Correct |
98 ms |
8824 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Runtime error |
4011 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
21 |
Halted |
0 ms |
0 KB |
- |