Submission #423877

#TimeUsernameProblemLanguageResultExecution timeMemory
423877ioiCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h"
#include<bits/stdc++.h>
using namespace std ;

void exploreCave(int N) {
//int main(){
    int N = 4 ;

    int com[N] , ans[N];
    memset(com , 0 , sizeof com);
    int anscom[N];

    memset(anscom , 0 , sizeof anscom);


    for(int i = 0 ; i < N ; i ++){
        int c = tryCombination(com);
        if(c != i){
            for(int j = 0 ; j < N ; j ++){
                if(!anscom[j])com[j] ^= 1 ;

            }


        }
        int l = 0 , r = N - 1 , md ;
        c = i ;


        while(l < r){


            md = (l + r) / 2 ;

            for(int j = l ; j <= md ; j ++){
                if(!anscom[j])com[j] ^= 1 ;

            }

            int c2 = tryCombination(com);
            for(int j = l ; j <= md ; j ++){
                if(!anscom[j])com[j] ^= 1 ;

            }
            if(c == c2)l = md + 1 ;
            else r = md ;



        }
       // cout << "l is " << l << endl ;
        anscom[l] ++ ;
        ans[l] = i ;
        com[l] ^= 1 ;

    }
    answer(com , ans);
   // for(int i = 0 ; i < N ; i ++)cout << com[i] << " " << ans[i] << endl ;
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:7:9: error: declaration of 'int N' shadows a parameter
    7 |     int N = 4 ;
      |         ^
cave.cpp:5:22: note: 'int N' previously declared here
    5 | void exploreCave(int N) {
      |                  ~~~~^