이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "minerals.h"
using namespace std;
#define rep(x,s,e) for (auto x=s;x<e;x++)
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
int curr=0;
void rec(vector<int> v1,vector<int> v2,bool flag){
/*
for (auto &it:v1) cout<<it<<" ";cout<<endl;
for (auto &it:v2) cout<<it<<" ";cout<<endl;
cout<<endl;
//*/
if (sz(v1)==1){
Answer(v1[0],v2[0]);
curr=Query(v1[0]);
if (flag) Query(v2[0]);
return;
}
rep(x,0,sz(v1)) swap(v1[x],v1[rng()%(x+1)]);
rep(x,0,sz(v2)) swap(v2[x],v2[rng()%(x+1)]);
vector<int> l1,l2,r1,r2;
int half=1;
while (half<sz(v1)) half<<=1;
half>>=1;
rep(x,0,half){
l1.push_back(v1[x]);
}
rep(x,half,sz(v1)){
curr=Query(v1[x]);
r1.push_back(v1[x]);
}
if (!flag){
for (auto &it:v2){
int temp=Query(it);
if (temp==curr){
l2.push_back(it);
}
else{
r2.push_back(it);
curr=temp;
}
}
rec(l1,l2,true),rec(r2,r1,false);
}
else{
for (auto &it:v2){
int temp=Query(it);
if (temp==curr){
l2.push_back(it);
}
else{
r2.push_back(it);
Query(it);
}
}
rec(l1,l2,false),rec(r2,r1,false);
}
}
void Solve(int n) {
vector<int> v1,v2;
rep(x,1,2*n+1){
int temp=Query(x);
if (temp==curr){
v2.push_back(x);
}
else{
v1.push_back(x);
}
curr=temp;
}
rec(v1,v2,true);
}
| # | 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... |