#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000010
#define ii pair<int,int>
#define fs first
#define sc second
#define ld double
#define int ll
int n,A,B;
vector<int>s;
const int MAX_VAL=2e18;
void sub_AB()
{
int res=0;
for(int i=1;i<=n;i++)
{
int l,r;
cin>>l>>r;
res+=(r-l+1);
}
cout<<res;
exit(0);
}
int32_t main()
{
#ifdef SKY
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
#endif // SKY
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>A>>B;
if(MAX_VAL/A<=B)
sub_AB();
//cout<<"CC";
for(int i=1;i<=n;i++)
{
int l,r;
cin>>l>>r;
for(int t=l;t<=r;t++)
s.pb(t%(A*B));
}
sort(s.begin(),s.end());
s.erase(unique(s.begin(),s.end()),s.end());
cout<<s.size();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
12 ms |
2512 KB |
Output is correct |
3 |
Correct |
27 ms |
4556 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Runtime error |
477 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
37 ms |
8648 KB |
Output is correct |
3 |
Correct |
42 ms |
8648 KB |
Output is correct |
4 |
Correct |
36 ms |
8648 KB |
Output is correct |
5 |
Runtime error |
481 ms |
524288 KB |
Execution killed with signal 9 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
384 ms |
8548 KB |
Output is correct |
3 |
Runtime error |
597 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
384 ms |
8548 KB |
Output is correct |
3 |
Runtime error |
597 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
384 ms |
8548 KB |
Output is correct |
3 |
Runtime error |
597 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1803 ms |
263088 KB |
Output is correct |
3 |
Runtime error |
603 ms |
524288 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
12 ms |
2512 KB |
Output is correct |
3 |
Correct |
27 ms |
4556 KB |
Output is correct |
4 |
Incorrect |
1 ms |
468 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |