// Only GOD
// believe in yourself
// nemidam del be in darde donya!
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#define bit(x, y) ((x >> y)&1)
#define sz(x) (int)x.size()
#define kill(x) return cout << x << '\n', void()
#define KILL(x) return cout << x << '\n', 0
#define int ll
const int N = 1e5+10;
const int INF = INT_MAX;
// this is a test!!!
int32_t main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n, A, B;
cin >> n >> A >> B;
int C = INF / A;
if(C < B){
int sum = 0;
for(int i = 0; i < n; i++){
int l, r;
cin >> l >> r;
sum += r - l + 1;
}
KILL(sum);
}
int mul = 1ll*A * B;
set<int> s;
for(int i = 0; i < n; i++){
int l, r;
cin >> l >> r;
for(int j = l; j <= r; j++){
s.insert(j % mul);
}
}
cout << sz(s) << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
37 ms |
9500 KB |
Output is correct |
3 |
Correct |
55 ms |
13736 KB |
Output is correct |
4 |
Incorrect |
2 ms |
852 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
3424 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
89 ms |
24192 KB |
Output is correct |
3 |
Correct |
87 ms |
24104 KB |
Output is correct |
4 |
Correct |
84 ms |
23004 KB |
Output is correct |
5 |
Execution timed out |
5066 ms |
46996 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
478 ms |
47344 KB |
Output is correct |
3 |
Incorrect |
290 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
478 ms |
47344 KB |
Output is correct |
3 |
Incorrect |
290 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
478 ms |
47344 KB |
Output is correct |
3 |
Incorrect |
290 ms |
444 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Runtime error |
2267 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
320 KB |
Output is correct |
2 |
Correct |
37 ms |
9500 KB |
Output is correct |
3 |
Correct |
55 ms |
13736 KB |
Output is correct |
4 |
Incorrect |
2 ms |
852 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |