Submission #813189

#TimeUsernameProblemLanguageResultExecution timeMemory
813189I_Love_EliskaM_Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)
#define pb push_back
#define all(x) x.begin(), x.end()
#define pi pair<int,int>
#define f first
#define s second
using ll = long long;

int ask(int q[]) {
  return tryCombination(q);
}
void exploreCave(int n) {
  int type[n], pos[n];
  forn(it,n) {
    int q[n];
    forn(i,n) q[i]=0;
    forn(i,it+1) q[pos[i]]=type[i];
    int x=ask(q);
    if (x > it) type[i]=0;
    else type[i]=1;
    int l=0, r=n-1;
    while (l<r) {
      int mid=(l+r)>>1;
      int q[n];
      forn(i,n) q[i]=type[i]^(i>mid);
      forn(i,it+1) q[pos[i]]=type[i];
      int x=ask(q);
      if (x>it) r=mid;
      else l=mid+1;
    }
    pos[i]=r;
  }
  answer(pos,type);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:22: error: 'i' was not declared in this scope
   22 |     if (x > it) type[i]=0;
      |                      ^
cave.cpp:23:15: error: 'i' was not declared in this scope
   23 |     else type[i]=1;
      |               ^
cave.cpp:34:9: error: 'i' was not declared in this scope
   34 |     pos[i]=r;
      |         ^