This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "Alice.h"
#include <vector>
using namespace std;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
const int N = 5000;
vpi Alice() {
long long x = setN(N);
vpi ij;
for (int j = 1; j < N; j++) {
int i = x % j;
ij.push_back(make_pair(i + 1, j + 1));
}
return ij;
}
#include "Bob.h"
#include <vector>
using namespace std;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
long long Bob(vpi ij) {
const long long M = 1000000000000000000;
int m = ij.size();
long long md = 1, x = 0;
for (int h = 0; h < m && md <= M; h++) {
int i = ij[h].first - 1, j = ij[h].second - 1;
while (x % j != i)
x += md;
int k = 1;
while (md * k <= M && md * k % j != 0)
k++;
md *= k;
}
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |