Submission #1010997

# Submission time Handle Problem Language Result Execution time Memory
1010997 2024-06-29T16:41:35 Z ttamx Magic Show (APIO24_show) C++17
0 / 100
2 ms 820 KB
#include <bits/stdc++.h>
#include "Alice.h"

using namespace std;

vector<pair<int,int>> Alice(){
    int n=5000;
    long long x=setN(n);
    vector<pair<int,int>> res;
    for(int i=1;i<n;i++)res.emplace_back(x%i+1,i+1);
    return res;
}
#include <bits/stdc++.h>
#include "Bob.h"

using namespace std;

using i128 = __int128_t;

long long Bob(vector<pair<int,int>> e){
    const i128 LIM=1e18;
    auto extgcd=[&](i128 a,i128 b){
        i128 u=1,v=0,q=0;
        while(b){
            q=a/b;
            a-=q*b,u-=q*v;
            swap(a,b),swap(u,v);
        }
        return make_tuple(a,u,v);
    };
    i128 a=0,m=0;
    for(auto [u,v]:e){
        if(m>LIM)break;
        u--,v--;
        if(u>v)swap(u,v);
        if(m==0){
            a=u,m=v;
            continue;
        }
        auto [g,x,y]=extgcd(m,v);
        a=a+x*(u-a)/g*m;
        m=m*v/g;
    }
    return a;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 820 KB Incorrect answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 820 KB Incorrect answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 820 KB Incorrect answer.
2 Halted 0 ms 0 KB -