# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
448722 | kimjg1119 | Chameleon's Love (JOI20_chameleon) | C++17 | 31 ms | 312 KiB |
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 "chameleon.h"
#include <bits/stdc++.h>
using namespace std;
int N;
vector<int> chk(1010);
void f(int x){
int left = 0;
for(int i=1;i<=N*2;i++) if(!chk[i]) left++;
auto mchk = chk;
while(left >= 2){
int mid = left / 2;
vector<int> v;
for(int i=1;i<=N*2;i++){
if(!mchk[i]) v.push_back(i);
if(v.size() == mid) break;
}
int ret1 = Query(v);
v.push_back(x);
int ret2 = Query(v);
if(ret1 == ret2){
int cnt = 0;
for(int i=1;i<=N*2;i++){
if(mchk[i]) continue;
if(cnt < mid) cnt++;
else mchk[i] = 1;
}
left = mid;
}
else{
int cnt = 0;
for(int i=1;i<=N*2;i++){
if(mchk[i]) continue;
cnt++; mchk[i] = 1;
if(cnt == mid) break;
}
left = left - mid;
}
}
for(int i=1;i<=N*2;i++){
if(!mchk[i]){
Answer(x, i);
chk[i] = 1;
break;
}
}
}
void Solve(int n){
N = n;
for(int i = 1; i <= N * 2; i++){
if(chk[i]) continue;
chk[i] = 1;
f(i);
}
}
Compilation message (stderr)
# | 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... |