#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
void Solve(int N) {
srand(2137);
vector<int> indeksy;
for (int i = 1; i <= 2*N; i++)
indeksy.push_back(i);
int prev = 0;
vector<int> wmaszynie;
int kand = 0;
while (indeksy.size()){
random_shuffle(indeksy.begin(), indeksy.end());
int nowe = Query(indeksy.back());
//cerr << nowe << " " << prev << "\n";
kand = indeksy.back();
indeksy.pop_back();
if (nowe == prev){
//cerr << "wtf\n";
while (wmaszynie.size()){
nowe = Query(wmaszynie.back());
if (nowe == prev){
Answer(wmaszynie.back(), kand);
prev = Query(kand);
wmaszynie.pop_back();
break;
}
prev = nowe;
indeksy.push_back(wmaszynie.back());
wmaszynie.pop_back();
}
}
else{
prev = nowe;
wmaszynie.push_back(kand);
}
}
}
# | 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... |