Submission #976781

# Submission time Handle Problem Language Result Execution time Memory
976781 2024-05-07T06:17:33 Z AIF_is_carving Strange Device (APIO19_strange_device) C++17
5 / 100
1 ms 500 KB
#include<bits/stdc++.h>
 
typedef long long ll;
using namespace std;



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n, A, B; cin>>n>>A>>B;
    ll x, y; cin>>x>>y;
    ll X = A/(gcd(B+1, A));

    //cout<<X<<"\n";

    ll t;

    //cout<<t<<"\n";

    int powX=0, powB=0;
    ll xxx = X;
    while(xxx>0){
        xxx/=2;
        powX+=1;
    }
    xxx=B;
    while(xxx>0){
        xxx/=2;
        powB+=1;
    }

    if(powB+powX>61) t=2e18;
    else t = B*X;
    //cout<<t<<"\n";

    cout<<min<ll>(y-x+1, t)<<"\n";

    return 0;
}
 
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 500 KB Output is correct
2 Incorrect 0 ms 388 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -