#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
typedef unsigned long long ull;
using namespace std;
const int N=1e6+5;
int n,a,b,l[N],r[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>a>>b;
for (int i=1;i<=n;i++) cin>>l[i]>>r[i];
set<pair<int,int>> s;
for (int i=1;i<=n;i++){
for (int j=l[i];j<=r[i];j++){
int x=(j+j/b)%a,y=j%b;
s.ep({x,y});
}
}
cout<<s.size()<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
33 ms |
14916 KB |
Output is correct |
3 |
Correct |
52 ms |
20480 KB |
Output is correct |
4 |
Correct |
2 ms |
2904 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
8 ms |
3164 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
32 ms |
9176 KB |
Output is correct |
16 |
Correct |
21 ms |
9308 KB |
Output is correct |
17 |
Correct |
47 ms |
16724 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Runtime error |
1955 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
114 ms |
34900 KB |
Output is correct |
3 |
Correct |
148 ms |
34080 KB |
Output is correct |
4 |
Correct |
101 ms |
32596 KB |
Output is correct |
5 |
Execution timed out |
5019 ms |
103764 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
399 ms |
115944 KB |
Output is correct |
3 |
Runtime error |
1556 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
399 ms |
115944 KB |
Output is correct |
3 |
Runtime error |
1556 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
399 ms |
115944 KB |
Output is correct |
3 |
Runtime error |
1556 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Runtime error |
1283 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
33 ms |
14916 KB |
Output is correct |
3 |
Correct |
52 ms |
20480 KB |
Output is correct |
4 |
Correct |
2 ms |
2904 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
8 ms |
3164 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
32 ms |
9176 KB |
Output is correct |
16 |
Correct |
21 ms |
9308 KB |
Output is correct |
17 |
Correct |
47 ms |
16724 KB |
Output is correct |
18 |
Correct |
1 ms |
2396 KB |
Output is correct |
19 |
Correct |
1 ms |
2396 KB |
Output is correct |
20 |
Runtime error |
1955 ms |
524288 KB |
Execution killed with signal 9 |
21 |
Halted |
0 ms |
0 KB |
- |