Submission #976783

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

void solve(){

    set<pair<ll, ll>> s;
    ll n, A, B; cin>>n>>A>>B;
    if(n>1){
        for(int i=0; i<n; i++){
            ll x, y; cin>>x>>y;
            for(ll t = x; t<=y; t++){
                ll p = (t+(t/B))%A;
                ll q = t%B;

                s.insert({p,q});
            }
        }

        cout<<s.size()<<"\n";
    }
    else{
        ll n, A, B; cin>>n>>A>>B;
    ll x, y; cin>>x>>y;
    ll X = A/(gcd(B+1, A));

    ll t;

    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<<min<ll>(y-x+1, t)<<"\n";

    }
    

    return;

}

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

    int t=1; //cin>>t;

    while(t--){
        solve();
    }

    return 0;

}
 
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -