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<iostream>
#include <bits/stdc++.h>
#include "minerals.h"
#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
void Solve(int N)
{
vector<int> v;
for (int i = 1; i <= 2 * N; ++i)
v.push_back(i);
for(int i=0; i<50; i++)
random_shuffle(v.begin(),v.end());
stack<int> st;
int last=0;
while(!v.empty())
{
int x= Query(v.back());
if(x!=last)
{
st.push(v.back());
v.pop_back();
last=x;
continue;
}
int a=v.back();
v.pop_back();
while(1)
{
x=Query(st.top());
if(x!=last)
{
v.push_back(st.top());
st.pop();
last=x;
continue;
}
Answer(st.top(), a);
st.pop();
last=Query(a);
break;
}
}
}
# | 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... |