이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <set>
using namespace std;
set <long long > s;
long long n,i,j,l,r,A,B,per;
long long lim=1LL*1e18+1;
long long gcd(long long x,long long y)
{
if((!x)||(!y)) return (x+y);
return gcd(y,x%y);
}
int main()
{
cin>>n>>A>>B;
long long t=gcd(A,B+1);
A/=t;
long long per;
if(lim/A<=B) per=lim;
else per=1LL*A*B;
for(i=1;i<=n;i++)
{
cin>>l>>r;
for(j=l;j<=r;j++)
s.insert(j%per);
}
cout<<s.size();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |