Submission #869091

#TimeUsernameProblemLanguageResultExecution timeMemory
869091AtabayRajabliCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h"
 
void exploreCave(int n) {
    int q = 0;
    int a[n], ans[n], d[n];
    for(int i = 0; i<n; i++)
    {
        a[i] = 0;
    }
    
    for(int i = 0; i<n; i++)
    {
        int q = tryCombination(a);
 
        for(int j = 0; j<n; j++)
        {
            a[j] ^= 1;
            int k = tryCombination(a);
            if(k == -1)k = n-1;
 
            if(k != q)
            {
                d[j] = k;
            }
            else a[j] ^= 1;
        }
        if(k)
    }
    
    answer(a, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:12: error: 'k' was not declared in this scope
   27 |         if(k)
      |            ^
cave.cpp:28:5: error: expected primary-expression before '}' token
   28 |     }
      |     ^
cave.cpp:4:9: warning: unused variable 'q' [-Wunused-variable]
    4 |     int q = 0;
      |         ^
cave.cpp:5:15: warning: unused variable 'ans' [-Wunused-variable]
    5 |     int a[n], ans[n], d[n];
      |               ^~~