#include "Alice.h"
#include <vector>
using namespace std;
constexpr int n = 5000;
vector<pair<int, int>> Alice() {
long long x = setN(n);
vector<pair<int, int>> r;
for (int i = 1; i < n; i++) r.emplace_back(i + 1, x % i + 1); // x = q(a - 1) + (b - 1)
return r;
}
#include "Bob.h"
#include <vector>
#include <algorithm>
using namespace std;
long long Bob(vector<pair<int, int>> V) {
long long ans = 0;
__int128_t ansmod = 1;
for (auto &[r, b] : V) {
if (--b < --r) swap(b, r);
// x = qb + r
while (ans % b != r) ans += ansmod;
ansmod *= b / __gcd<long long>(b, ansmod);
if (ansmod > __int128(1e18)) break;
}
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... |