제출 #1202213

#제출 시각아이디문제언어결과실행 시간메모리
1202213Bzslayed마술쇼 (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;

// 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){
		ll r = it.fi-1, m = it.se;
		while (ans.fi%m != r) ans.fi += ans.se;
		//cout << m << ' ' << r << ' ' << lc << ' '<< '\n';
		int gc = m/gcd(m, ans.se);
		if (1e18 / gc < ans.se) break;
		ans.se *= gc;
    }

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