Submission #1354296

#TimeUsernameProblemLanguageResultExecution timeMemory
1354296TroySerMagic Show (APIO24_show)C++20
0 / 100
1 ms352 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++) {
        treeEdges.push_back({mod, (X % mod) + 1});
    }

    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 x (mod i)
        auto [x, m] = congruence;
        x--;
        
        while (totalX % m != 0) {
            totalX += totalM;
        }

        totalM = lcm(totalM, m);
        totalX %= totalM;

        if (totalX > MAX_CAP) break;

    }

    return totalX;

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