제출 #423877

#제출 시각아이디문제언어결과실행 시간메모리
423877ioi동굴 (IOI13_cave)C++14
컴파일 에러
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 ; }

컴파일 시 표준 에러 (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) {
      |                  ~~~~^