#include <bits/stdc++.h>
using namespace std;
int n;
long long a, b, mod;
long long l, r, last=0, sum = 0;
set<long long> s;
int main() {
cin.tie(0) -> sync_with_stdio(0);
cin >> n >> a >> b;
if(a >= 4e18/b) mod = 4e18;
else mod = a*b;
while(n--) {
cin >> l >> r;
for(long long i=l,ct=l%mod;i<=r;i++,ct=(ct==mod-1?0:ct+1)) s.emplace(ct);
}
cout << s.size();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
27 ms |
9628 KB |
Output is correct |
3 |
Correct |
42 ms |
13772 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 |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
3122 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 |
73 ms |
24280 KB |
Output is correct |
3 |
Correct |
73 ms |
24148 KB |
Output is correct |
4 |
Correct |
70 ms |
23064 KB |
Output is correct |
5 |
Execution timed out |
5073 ms |
46924 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 |
410 ms |
50648 KB |
Output is correct |
3 |
Runtime error |
1749 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 |
410 ms |
50648 KB |
Output is correct |
3 |
Runtime error |
1749 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 |
410 ms |
50648 KB |
Output is correct |
3 |
Runtime error |
1749 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 |
Runtime error |
1655 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 |
27 ms |
9628 KB |
Output is correct |
3 |
Correct |
42 ms |
13772 KB |
Output is correct |
4 |
Incorrect |
2 ms |
852 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |