Submission #1217593

#TimeUsernameProblemLanguageResultExecution timeMemory
1217593LeonidCukCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int n)
{
    vector<bool>vis(n);
    int res[n],res1[n];
    for(int i=0;i<n;i++)
    {
        res[i]=0;
        res1[i]=0;
    }
    int a,b;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(vis[j]==0)
            {
                res[j]=0;
            }
        }
        a=tryCombination(res);
        if(a==i)b=1;
        else b=0;
        int l=0,r=n-1;
        while(l<r)
        {
            int m=(l+r)/2;
            for(int j=0;j<n;j++)
            {
                if(vis[j])continue;
                if(j<=m)res[j]=b;
                else res[j]=(b+1)%2;
                a=tryCombination(res);
                if(a==i)l=m+1;
                else r=m;
            }
            res[l]=b;
            vis[l]=true;
            res2[i]=l;
        }
    }
    answer(res,res2);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:41:13: error: 'res2' was not declared in this scope; did you mean 'res1'?
   41 |             res2[i]=l;
      |             ^~~~
      |             res1
cave.cpp:44:16: error: 'res2' was not declared in this scope; did you mean 'res1'?
   44 |     answer(res,res2);
      |                ^~~~
      |                res1