#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, A, B, ans = 0;
cin >> n >> A >> B;
map<int, bool> mp;
int mul = 3E18;
if (3E18 / A >= B) mul = A * B;
for (int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;
for (int j = l; j <= r; j++) mp[j % mul] = 1;
}
for (auto& [key, x] : mp) ans += x;
cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
46 ms |
12364 KB |
Output is correct |
3 |
Correct |
64 ms |
17844 KB |
Output is correct |
4 |
Incorrect |
3 ms |
980 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
2910 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 |
105 ms |
32212 KB |
Output is correct |
3 |
Correct |
106 ms |
32048 KB |
Output is correct |
4 |
Correct |
104 ms |
30536 KB |
Output is correct |
5 |
Execution timed out |
5057 ms |
62408 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
512 ms |
62872 KB |
Output is correct |
3 |
Runtime error |
1627 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 |
512 ms |
62872 KB |
Output is correct |
3 |
Runtime error |
1627 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 |
512 ms |
62872 KB |
Output is correct |
3 |
Runtime error |
1627 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 |
Runtime error |
1653 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 |
46 ms |
12364 KB |
Output is correct |
3 |
Correct |
64 ms |
17844 KB |
Output is correct |
4 |
Incorrect |
3 ms |
980 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |