제출 #299103

#제출 시각아이디문제언어결과실행 시간메모리
299103erd1Cave (IOI13_cave)C++14
100 / 100
1477 ms764 KiB
#include "cave.h"

#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define pb push_back
typedef int64_t lld;
typedef pair<int, int> pii;

vector<int> v;
int query[5000] = {}, ans[5000] = {}, pos[5000] = {};
void exploreCave(int N){
  v.resize(N);
  fill(all(v), 1);
  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++)
      query[j] = ans[j] || v[j];
    bool correct = (tryCombination(query) != i);
    int l = 0, r = N+1;
    while(r-l > 1){
      for(int j = 0; j < N; j++)
        query[j] = ans[j] || (v[j] && (j < (l+r)/2?correct:!correct));
      if(tryCombination(query) == i)l = (l+r)/2;
      else r = (l+r)/2;
    }
    v[l] = 0;
    ans[l] = correct;
    pos[l] = i;
  }
  answer(ans, pos);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...