#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){
ll ans = 0, lc = 1;
for (auto [r, m] : V){
r--;
if (r > m) swap(r, m);
while (ans%m != r) ans += lc;
//cout << m << ' ' << r << ' ' << lc << ' '<< '\n';
ll gc = m/gcd(m, lc);
if (1e18 / gc < lc) break;
lc *= gc;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |