Submission #1047815

# Submission time Handle Problem Language Result Execution time Memory
1047815 2024-08-07T16:12:33 Z Arturgo Magic Show (APIO24_show) C++17
5 / 100
2 ms 1068 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>> arbre;
    for(int i = 2;i <= N;i++) {
        arbre.push_back({1 + X % (i - 1), i});
    }

    return arbre;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;

__int128 modInv(__int128 a, __int128 b, __int128& u, __int128& v) {
    if(a == 0) {
        u = 0;
        v = 1;
        return b;
    }

    __int128 r = b / a;
    __int128 g = modInv(b - r * a, a, u, v);

    __int128 nu = v - r * u;
    __int128 nv = u;
    u = nu;
    v = nv;
    return g;
}


long long Bob(vector<pair<int, int>> aretes){
	long long X = 0;
    __int128 N = 1;

    for(pair<int, int>& arete : aretes) {
        int modX = arete.first - 1, p = arete.second - 1; 

        while(X % p != modX) {
            X += N;
        }

        if(N >= 1e18) break;
    }

    return X;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1068 KB Correct.
2 Correct 1 ms 828 KB Correct.
3 Correct 1 ms 836 KB Correct.
4 Correct 2 ms 820 KB Correct.
5 Correct 1 ms 824 KB Correct.
6 Correct 1 ms 832 KB Correct.
7 Correct 1 ms 832 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 1 ms 832 KB Correct.
12 Correct 2 ms 820 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1068 KB Correct.
2 Correct 1 ms 828 KB Correct.
3 Correct 1 ms 836 KB Correct.
4 Correct 2 ms 820 KB Correct.
5 Correct 1 ms 824 KB Correct.
6 Correct 1 ms 832 KB Correct.
7 Correct 1 ms 832 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 1 ms 832 KB Correct.
12 Correct 2 ms 820 KB Correct.
13 Incorrect 1 ms 828 KB Incorrect answer.
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1068 KB Correct.
2 Correct 1 ms 828 KB Correct.
3 Correct 1 ms 836 KB Correct.
4 Correct 2 ms 820 KB Correct.
5 Correct 1 ms 824 KB Correct.
6 Correct 1 ms 832 KB Correct.
7 Correct 1 ms 832 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 1 ms 832 KB Correct.
12 Correct 2 ms 820 KB Correct.
13 Incorrect 1 ms 828 KB Incorrect answer.
14 Halted 0 ms 0 KB -