#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 = __int128(A)*__int128(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 |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
37 ms |
12424 KB |
Output is correct |
3 |
Correct |
51 ms |
18004 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 |
2632 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
500 KB |
Output is correct |
2 |
Correct |
93 ms |
32380 KB |
Output is correct |
3 |
Correct |
93 ms |
32080 KB |
Output is correct |
4 |
Correct |
87 ms |
30484 KB |
Output is correct |
5 |
Execution timed out |
5028 ms |
62580 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
465 ms |
62844 KB |
Output is correct |
3 |
Runtime error |
1501 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
465 ms |
62844 KB |
Output is correct |
3 |
Runtime error |
1501 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
465 ms |
62844 KB |
Output is correct |
3 |
Runtime error |
1501 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
1561 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
37 ms |
12424 KB |
Output is correct |
3 |
Correct |
51 ms |
18004 KB |
Output is correct |
4 |
Incorrect |
2 ms |
1116 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |