# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124493 | TadijaSebez | Strange Device (APIO19_strange_device) | C++11 | 986 ms | 51284 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const ll inf=9e18;
const int N=1000050;
ll l[N],r[N];
int main()
{
int n;
ll A,B;
scanf("%i %lld %lld",&n,&A,&B);
for(int i=1;i<=n;i++) scanf("%lld %lld",&l[i],&r[i]);
ll x=A/__gcd(A,B+1);
if(inf/x>B)
{
ll P=x*B;
//printf("P:%lld\n",P);
bool all=0;
vector<pair<ll,int>> evs;
for(int i=1;i<=n;i++)
{
if(r[i]-l[i]+1>=P) all=1;
r[i]%=P;
l[i]%=P;
if(r[i]<l[i]) evs.pb({0,1}),evs.pb({P,-1});
evs.pb({l[i],1});
evs.pb({r[i]+1,-1});
}
if(all) printf("%lld\n",P);
Compilation message (stderr)
# | 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... |