제출 #1202210

#제출 시각아이디문제언어결과실행 시간메모리
1202210Bzslayed마술쇼 (APIO24_show)C++20
0 / 100
1 ms328 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;

#define ll long long
#define pii pair<int, int>

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

vector<pii> Alice(){
    ll x = setN(5000);
    vector<pii> edges;
    for (int i=1; i<5000; i++){
        int v = x%i;
        edges.push_back({v+1, i});
    }

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

#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fi first
#define se second

const ll INF = 1e18;
bool done = false;
pll crt(pll x, pll y){
	ll r = y.fi-1, m = y.se;
	while (x.fi%m != r) x.fi += x.se;
	int gc = m/gcd(m, x.se);
	if (INF/gc < x.se) done = true;
	else x.se *= gc;

    return x;
}

// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().

ll Bob(vector<pii> V){
    pll ans = {0, 1};
	for (auto it : V){
        ans = crt(ans, it);
        if (done) break;
    }

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