이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int cnt = 0;
vector<int> ex;
void pbs(int l, int r, bool right, bool reset, vector<int> X){
if(l == r){
for(int i: X) Answer(i, ex[l]);
return;
}
int md = (l+r)/2;
if(right) for(int i = l; i <= md; i++) cnt = Query(ex[i]);
else for(int i = r; i > md; i--) cnt = Query(ex[i]);
vector<int> A, B;
for(int i: X){
int cnt_ = Query(i);
if(cnt_ == cnt) A.push_back(i);
else B.push_back(i);
Query(i);
}
pbs(l, md, 0, 1, A);
pbs(md+1, r, 1, reset, B);
if(reset){
if(right) for(int i = l; i <= md; i++) cnt = Query(ex[i]);
else for(int i = r; i > md; i--) cnt = Query(ex[i]);
}
}
void Solve(int n){
vector<int> X;
for(int i = 1; i <= 2*n; i++){
int cnt_ = Query(i);
if(cnt_ == cnt) ex.push_back(i);
else X.push_back(i);
cnt = cnt_;
}
for(int i: X) Query(i);
pbs(0, n-1, 0, 0, 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... |