#include <bits/stdc++.h>
using namespace std;
const long long INF = 2e18;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int N;
long long A, B;
cin >> N >> A >> B;
long long M = INF / A >= B ? A * B : INF;
vector<long long> rem;
for (int i = 0; i < N; i++) {
long long L, R;
cin >> L >> R;
for (auto i = L; i <= R; i++) {
rem.push_back(i % M);
}
}
sort(rem.begin(), rem.end());
cout << (unique(rem.begin(), rem.end()) - rem.begin()) << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
10 ms |
2896 KB |
Output is correct |
3 |
Correct |
26 ms |
4928 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
320 KB |
Output is correct |
2 |
Runtime error |
488 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
31 ms |
8640 KB |
Output is correct |
3 |
Correct |
33 ms |
8648 KB |
Output is correct |
4 |
Correct |
31 ms |
8640 KB |
Output is correct |
5 |
Runtime error |
484 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
292 ms |
9032 KB |
Output is correct |
3 |
Runtime error |
647 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
292 ms |
9032 KB |
Output is correct |
3 |
Runtime error |
647 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
292 ms |
9032 KB |
Output is correct |
3 |
Runtime error |
647 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1588 ms |
263852 KB |
Output is correct |
3 |
Runtime error |
556 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
10 ms |
2896 KB |
Output is correct |
3 |
Correct |
26 ms |
4928 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |