Submission #1011004

# Submission time Handle Problem Language Result Execution time Memory
1011004 2024-06-29T16:49:48 Z ttamx Magic Show (APIO24_show) C++17
35 / 100
2 ms 1072 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;

i128 extgcd(i128 a, i128 b, i128 &x, i128 &y){
	if(!b)return x=1,y=0,a;
	i128 d=extgcd(b,a%b,y,x);
	return y-=a/b*x,d;
}

long long Bob(vector<pair<int,int>> e){
    const i128 LIM=1e18;
    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;
        }
        i128 g,x,y;
        g=extgcd(m,v,x,y);
        a=a+x*(u-a)/g*m;
        m=m/g*v;
        a%=m;
        if(a<0)a+=m;
    }
    return a;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 820 KB Correct.
2 Correct 1 ms 820 KB Correct.
3 Correct 1 ms 832 KB Correct.
4 Correct 1 ms 836 KB Correct.
5 Correct 1 ms 820 KB Correct.
6 Correct 2 ms 832 KB Correct.
7 Correct 1 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 820 KB Correct.
11 Correct 2 ms 820 KB Correct.
12 Correct 2 ms 828 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 820 KB Correct.
2 Correct 1 ms 820 KB Correct.
3 Correct 1 ms 832 KB Correct.
4 Correct 1 ms 836 KB Correct.
5 Correct 1 ms 820 KB Correct.
6 Correct 2 ms 832 KB Correct.
7 Correct 1 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 820 KB Correct.
11 Correct 2 ms 820 KB Correct.
12 Correct 2 ms 828 KB Correct.
13 Correct 2 ms 820 KB Correct.
14 Correct 1 ms 832 KB Correct.
15 Correct 1 ms 820 KB Correct.
16 Correct 1 ms 816 KB Correct.
17 Correct 1 ms 832 KB Correct.
18 Correct 2 ms 832 KB Correct.
19 Correct 1 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 1 ms 820 KB Correct.
22 Correct 1 ms 1072 KB Correct.
23 Correct 2 ms 820 KB Correct.
24 Correct 1 ms 832 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 820 KB Correct.
2 Correct 1 ms 820 KB Correct.
3 Correct 1 ms 832 KB Correct.
4 Correct 1 ms 836 KB Correct.
5 Correct 1 ms 820 KB Correct.
6 Correct 2 ms 832 KB Correct.
7 Correct 1 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 820 KB Correct.
10 Correct 1 ms 820 KB Correct.
11 Correct 2 ms 820 KB Correct.
12 Correct 2 ms 828 KB Correct.
13 Correct 2 ms 820 KB Correct.
14 Correct 1 ms 832 KB Correct.
15 Correct 1 ms 820 KB Correct.
16 Correct 1 ms 816 KB Correct.
17 Correct 1 ms 832 KB Correct.
18 Correct 2 ms 832 KB Correct.
19 Correct 1 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 1 ms 820 KB Correct.
22 Correct 1 ms 1072 KB Correct.
23 Correct 2 ms 820 KB Correct.
24 Correct 1 ms 832 KB Correct.
25 Correct 2 ms 828 KB Correct.
26 Correct 2 ms 820 KB Correct.
27 Correct 2 ms 824 KB Correct.
28 Correct 2 ms 828 KB Correct.
29 Correct 2 ms 820 KB Correct.
30 Incorrect 1 ms 832 KB Incorrect answer.
31 Halted 0 ms 0 KB -