Submission #1354314

#TimeUsernameProblemLanguageResultExecution timeMemory
1354314TroySerMagic Show (APIO24_show)C++20
0 / 100
3 ms356 KiB
#include <bits/stdc++.h>
#include <vector>
#include "Alice.h"

using namespace std;
using ll = long long;

vector<pair<int,int> > Alice() {
    
    ll X = setN(1000);

    vector<pair<int, int> > treeEdges;
    treeEdges.reserve(1000 - 1);
    
    // always connect to previous index, which is GUARANTEED to be connected
    // by induction; moreover N - 1 edges w/ N vertices guarantees tree
    for (ll mod = 2; mod <= 1000; mod++) {
        // at most [1, mod - 1]
        treeEdges.push_back({(X % (mod - 1)) + 1, mod});
    }

    return treeEdges;

}
#include <bits/stdc++.h>
#include <vector>
#include "Bob.h"

using namespace std;
using ll = long long;

const ll MAX_CAP = 1e18;

ll Bob(vector<pair<int, int> > V) {

    // totalX (mod totalM)
    ll totalX = 0, totalM = 1;
    
    for (auto &congruence: V) {

        // it is in form r (mod m)
        auto [r, m] = congruence;
        // r: [0, mod - 2], which is of class (mod m - 1)
        if (r > m) swap(r, m);
        r--; m--;
        
        while (totalX % m != r) {
            totalX += totalM;
        }

        ll _gcd = gcd(totalM, m);
        if (m > MAX_CAP / (totalM / _gcd)) break;
        totalX %= totalM;

    }

    return totalX;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...