Submission #1319393

#TimeUsernameProblemLanguageResultExecution timeMemory
1319393lrnnzMagic Show (APIO24_show)C++20
0 / 100
1 ms340 KiB
#include <bits/stdc++.h>
using namespace std;

#define all(a) (a).begin(), (a).end()
#define ll long long
#define ld long double
#define ui __int128_t
#define pb push_back

template<class T, class U> inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return true; } return false; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

static inline uint64_t splitmix64(uint64_t &x) {
    x += 0x9e3779b97f4a7c15ULL;
    uint64_t z = x;
    z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ULL;
    z = (z ^ (z >> 27)) * 0x94d049bb133111ebULL;
    return z ^ (z >> 31);
}

/********* DEBUG *********/

template<typename T>
struct is_vector : false_type {};

template<typename T, typename A>
struct is_vector<vector<T, A>> : true_type {};

template<typename T>
void print_one(const T& x) {
    if constexpr (is_vector<T>::value) {
        for (size_t i = 0; i < x.size(); i++) {
            cout << x[i];
            // if (i + 1 < x.size()) cout << ' ';
        }
    } else {
        cout << x;
    }
}

template<typename... Args>
void out(const Args&... args) {
    bool first = true;

    auto print_arg = [&](const auto& v) {
        // if (!first) cout << ' ';
        first = false;
        print_one(v);
    };

    (print_arg(args), ...);
    cout << "\n";
}

/********* DEBUG *********/

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll inf = 1e18;
const ll RUNS = 100000;
const ll LOG = 31;
const ll MAXN = 2e5;

#include "Alice.h"
// #include "Bob.h"

vector<pair<int,int>> Alice(){
    ll n = 100;
    ll x = setN(n);
    vector<pair<int,int>> tree;

    for (int i = 2; i <= n; i++) {
        tree.pb({i, x % i});
    }

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

#define all(a) (a).begin(), (a).end()
#define ll long long
#define ld long double
#define ui __int128_t
#define pb push_back

template<class T, class U> inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return true; } return false; }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

static inline uint64_t splitmix64(uint64_t &x) {
    x += 0x9e3779b97f4a7c15ULL;
    uint64_t z = x;
    z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9ULL;
    z = (z ^ (z >> 27)) * 0x94d049bb133111ebULL;
    return z ^ (z >> 31);
}

/********* DEBUG *********/

template<typename T>
struct is_vector : false_type {};

template<typename T, typename A>
struct is_vector<vector<T, A>> : true_type {};

template<typename T>
void print_one(const T& x) {
    if constexpr (is_vector<T>::value) {
        for (size_t i = 0; i < x.size(); i++) {
            cout << x[i];
            // if (i + 1 < x.size()) cout << ' ';
        }
    } else {
        cout << x;
    }
}

template<typename... Args>
void out(const Args&... args) {
    bool first = true;

    auto print_arg = [&](const auto& v) {
        // if (!first) cout << ' ';
        first = false;
        print_one(v);
    };

    (print_arg(args), ...);
    cout << "\n";
}

/********* DEBUG *********/

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll inf = 1e18;
const ll RUNS = 100000;
const ll LOG = 31;
const ll MAXN = 2e5;

// #include "Alice.h"
#include "Bob.h"

ll Bob(vector<pair<int,int>> V){
    
    ll ans = 1, d = 1;
    for (auto [rem, div] : V) {
        if (rem > div) swap(rem, div);
        while (ans % div != rem) {
            ans += d;
        }

        d = lcm(d, div);
    }

    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...