# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
379172 | Bill_00 | Strange Device (APIO19_strange_device) | C++14 | 1755 ms | 69320 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>
typedef long long ll;
#define N 20005
#define ff first
#define ss second
#define pb push_back
using namespace std;
ll gcd(ll a,ll b){
while(a!=0 && b!=0){
if(a>b){
a=a%b;
}
else b=b%a;
}
return max(a,b);
}
vector<pair<pair<ll,ll>,pair<ll,ll> > >v;
int main(){
ll n,a,b;
cin >> n >> a >> b;
ll k=gcd(a,(b+1));
k=a/k;
ll y=1e18;
for(int i=1;i<=n;i++){
ll l,r;
cin >> l >> r;
if(y/b>=k){
if(k*b<=(r-l+1)){
cout << k*b;
return 0;
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... |