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 <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
void Solve(int n){
deque<int> added, to_be_added;
for(int i = 1; i <= 2*n; i++) to_be_added.push_back(i);
int old = 0;
while(!added.empty() || !to_be_added.empty()){
int x = Query(to_be_added[0]);
added.push_back(to_be_added[0]);
to_be_added.pop_front();
if(x > old){
old = x;
continue;
}
int old_ = old;
while(1){
int i = added[0]; added.pop_front();
int x = Query(i);
if(x == old_){
old = Query(added.back());
Answer(i, added.back());
added.pop_back();
break;
}
to_be_added.push_back(i);
old_ = 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... |
# | 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... |