#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n,A,B;
cin >> n >> A >> B;
__int128 modulus;
if((B+1)%A==0){
modulus = B;
} else {
modulus = A*B;
}
set<__int128> answers;
for(int i=1;i<=n;i++){
int l,r;cin>>l>>r;
for(int x=l;x<=r;x++){
answers.insert(__int128(x)%modulus);
}
}
cout << answers.size() << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
42 ms |
12712 KB |
Output is correct |
3 |
Correct |
53 ms |
18280 KB |
Output is correct |
4 |
Incorrect |
2 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
2658 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
108 ms |
32448 KB |
Output is correct |
3 |
Correct |
92 ms |
32084 KB |
Output is correct |
4 |
Correct |
93 ms |
30656 KB |
Output is correct |
5 |
Execution timed out |
5104 ms |
62500 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
454 ms |
100056 KB |
Output is correct |
3 |
Runtime error |
1489 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
454 ms |
100056 KB |
Output is correct |
3 |
Runtime error |
1489 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
454 ms |
100056 KB |
Output is correct |
3 |
Runtime error |
1489 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Runtime error |
1509 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
42 ms |
12712 KB |
Output is correct |
3 |
Correct |
53 ms |
18280 KB |
Output is correct |
4 |
Incorrect |
2 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |