Submission #1106385

#TimeUsernameProblemLanguageResultExecution timeMemory
1106385NonbangkokCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "cave.h"

void exploreCave(int N) {
    int S[N], D[N], last=-2, start=0, closed;
    for(int i=0;i<N;i++)S[i]=D[i]=0;

    while(start!=N){
        for(int i=start;i<N;i++){
            int closed = tryCombination(S);
            if(closed != last){
                D[last] = i;
                start++;
                i = start;
                last = closed;
                continue;
            }
            S[i] = 1;
            int closed = tryCombination(S);
            if(closed != last){
                D[last] = i;
                start++;
                i = start;
                last = closed;
                continue;
            }
            S[i] = 0;
        }
    }
    answer(S,D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:17: error: redeclaration of 'int closed'
   19 |             int closed = tryCombination(S);
      |                 ^~~~~~
cave.cpp:10:17: note: 'int closed' previously declared here
   10 |             int closed = tryCombination(S);
      |                 ^~~~~~
cave.cpp:5:39: warning: unused variable 'closed' [-Wunused-variable]
    5 |     int S[N], D[N], last=-2, start=0, closed;
      |                                       ^~~~~~