Submission #1221002

#TimeUsernameProblemLanguageResultExecution timeMemory
1221002hmms127Cave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define f2(m,n) for(int i=m;i<n;i++)
#define f4(m,n) for(int j=m;i<n;j++)
void exploreCave(int N){	
   int sw[N]={},dr[N]={};
   bool vis[N]={};
   f2(0,n){
      f4(0,n)if(!vis[j])sw[j]=0;
      int x=tryCombination(sw);
      bool bt=(x==i ? 1:0);
      int l=0,r=n-1,ans=0;
      while(l<=r){
          int mid=(l+r)/2;
          f4(0,n){
              if(!vis[j]){
                  if(j<=mid)sw[i]=bt;
                  else sw[i]=bt^1;
              }
          }
          int x=tryCombination(sw); 
          if(x==i)ans=mid,l=mid+1;
          else r=mid-1;
      }
      vis[ans]=1;
      sw[ans]=bt;
      dr[ans]=i;
   }
   answer(sw,dr);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:9:9: error: 'n' was not declared in this scope
    9 |    f2(0,n){
      |         ^
cave.cpp:4:31: note: in definition of macro 'f2'
    4 | #define f2(m,n) for(int i=m;i<n;i++)
      |                               ^
cave.cpp:23:19: error: 'ans' was not declared in this scope; did you mean 'abs'?
   23 |           if(x==i)ans=mid,l=mid+1;
      |                   ^~~
      |                   abs
cave.cpp:26:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |       vis[ans]=1;
      |           ^~~
      |           abs