#include <bits/stdc++.h>
#define stop system("pause")
#define INP freopen("input.txt","r",stdin)
#define OUTP freopen("solve2.txt","w",stdout)
#define int long long
#define double long double
using namespace std;
map<int,int> m;
main()
{
int n,a,b; cin >> n >> a >> b;
double kek = a*b/__gcd(a,b+1);
int lcm;
if(kek >= 1e18+228)lcm = 1e18+228;
else lcm = a*b;
int res = 0;
assert(lcm != 1e18+228);
for(int i(0); i < n;i++){
int l,r; cin >> l >> r;
for(int j(l);j<=r;j++){
if(m[j%lcm] == 0)res++;
m[j%lcm]++;
}
}
cout << res;
return 0;
}
/*
5
1 1
1 4
4 1
4 4
2 2
*/
Compilation message
strange_device.cpp:12:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
103 ms |
12664 KB |
Output is correct |
3 |
Correct |
167 ms |
18288 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1020 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Execution timed out |
5122 ms |
384796 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
207 ms |
32300 KB |
Output is correct |
3 |
Correct |
200 ms |
32116 KB |
Output is correct |
4 |
Correct |
191 ms |
30640 KB |
Output is correct |
5 |
Execution timed out |
5053 ms |
62536 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
128 KB |
Output is correct |
2 |
Correct |
3103 ms |
63808 KB |
Output is correct |
3 |
Runtime error |
4811 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
128 KB |
Output is correct |
2 |
Correct |
3103 ms |
63808 KB |
Output is correct |
3 |
Runtime error |
4811 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
128 KB |
Output is correct |
2 |
Correct |
3103 ms |
63808 KB |
Output is correct |
3 |
Runtime error |
4811 ms |
524292 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Runtime error |
4697 ms |
524288 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
103 ms |
12664 KB |
Output is correct |
3 |
Correct |
167 ms |
18288 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1020 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |