Submission #1191498

#TimeUsernameProblemLanguageResultExecution timeMemory
1191498siewjh마술쇼 (APIO24_show)C++20
100 / 100
3 ms380 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
typedef long long ll;

// 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<pair<int, int>> Alice(){
	ll x = setN(5000);
	vector<pair<int, int>> elist(4999);
	for (int i = 1; i < 5000; i++) elist[i - 1] = {x % i + 1, i + 1};
	return elist;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
typedef long long ll;
const ll MAXV = 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<pair<int, int>> V){
	ll mod = 1, rem = 0;
	for (auto [a, b] : V){
		a--; b--;
		if (a > b) swap(a, b);
		while (rem % b != a) rem += mod;
		ll gcdv = gcd(mod, b);
		if (mod / gcdv > MAXV / b) break;
		mod = mod / gcdv * b;
	}
	return rem;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...