#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
vector<int> g[5005];
vector<pair<int, int>> Alice() {
long long int x = setN(5000);
int n = 5000;
for (int i = 2; i < n; i++) {
g[x % i + 1].push_back(i + 1);
}
vector<pair<int, int>> v;
for (int i = 1; i <= n; i++) {
for (int w : g[i]) {
v.push_back({i, w});
if (i == w) exit(0);
}
}
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(v.begin(), v.end(), std::default_random_engine(seed));
return v;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
long long int Bob(vector<pair<int, int>> v) {
long long int res = 0, c = 1;
for (auto w : v) {
if (w.first > w.second) swap(w.first, w.second);
w.first--;
w.second--;
while (res % w.second != w.first) {
res += c;
}
int h = __gcd(1ll * w.second, c);
c /= h; c *= w.second;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |