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 "minerals.h"
#include <iostream>
#include <vector>
using namespace std;
void Solve(int N) {
vector<int> fst;
vector<int> snd;
int prev = 0;
for (int i = 1; i <= N*2; i++) {
int tmp = Query(i);
if (tmp > prev) fst.push_back(i);
prev = tmp;
}
for (int i = 1, j = 0; i <= N*2; i++) {
if (j<N && i == fst[j]) {
j++;
continue;
}
snd.push_back(i);
}
int baseline;
for (int i = 0; i < N; i++) {
if (i&1) baseline = Query(fst[i]);
}
vector<int> ids(N, 0);
for (int pd = 1; pd < N; pd <<= 1) {
if (pd > 1) {
for (int i = 0; i < N; i++) {
if ((i&pd) ^ ((i<<1)&pd)) baseline = Query(fst[i]);
}
}
for (int i = 0; i < N; i++) {
int tmp = Query(snd[i]);
int bit = (tmp != baseline);
baseline = tmp;
ids[i] += bit * pd;
}
}
for (int i = 0; i < N; i++) {
Answer(fst[ids[i]], snd[i]);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |