#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 = 1.0L*a*b;
int lcm;
if(kek >= 1e18+228)lcm = 1e18+228;
else lcm = a*b;
int res = 0;
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 |
348 KB |
Output is correct |
2 |
Correct |
103 ms |
12408 KB |
Output is correct |
3 |
Correct |
168 ms |
17992 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1016 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
5039 ms |
359956 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
292 KB |
Output is correct |
2 |
Correct |
204 ms |
32292 KB |
Output is correct |
3 |
Correct |
203 ms |
32088 KB |
Output is correct |
4 |
Correct |
207 ms |
30680 KB |
Output is correct |
5 |
Execution timed out |
5066 ms |
62584 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3114 ms |
63992 KB |
Output is correct |
3 |
Runtime error |
4833 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 |
Correct |
3114 ms |
63992 KB |
Output is correct |
3 |
Runtime error |
4833 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 |
Correct |
3114 ms |
63992 KB |
Output is correct |
3 |
Runtime error |
4833 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 |
348 KB |
Output is correct |
2 |
Runtime error |
4688 ms |
524292 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 |
348 KB |
Output is correct |
2 |
Correct |
103 ms |
12408 KB |
Output is correct |
3 |
Correct |
168 ms |
17992 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1016 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |