제출 #1310670

#제출 시각아이디문제언어결과실행 시간메모리
1310670putuputu동굴 (IOI13_cave)C++20
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int n) { int n; cin >> n; vector<int> s(n, 0); vector<int> use(n, 0); vector<int> dswitch(n, -1); vector<int> state(n, 0); for(int i=0; i<n; i++){ vector<int>c; for(int j=0; j<n; j++){ if(!use[j]){ c.push_back(j); } } int l=0, r=(int)c.size()-1; int find=-1; while(l<=r){ int m=(l+r)/2; for(int j=0; j<n; j++){ s[j]=0; } for(int j=0; j<i; j++){ s[dswitch[i]]=state[i]; } for(int j=l; j<m; j++){ s[c[j]]=1; } int res=tryCombination(s.data()); if(res==-1 or res>i){ find=c[m]; r=m-1; }else{ l=m+1; } } for(int j=0; j<n; j++){ s[j]=0; } for(int j=0; j<i; j++){ s[dswitch[j]]=state[j]; } s[find]=0; int res=tryCombination(s.data()); int need; if(res==-1 or res>i){ need=0; }else{ need=1; } use[find]=1; dswitch[i]=find; state[i]=need; } answer(sdwitch.data(), state.data()); }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:5:9: error: declaration of 'int n' shadows a parameter
    5 |     int n;
      |         ^
cave.cpp:4:22: note: 'int n' previously declared here
    4 | void exploreCave(int n) {
      |                  ~~~~^
cave.cpp:57:12: error: 'sdwitch' was not declared in this scope; did you mean 'dswitch'?
   57 |     answer(sdwitch.data(), state.data());
      |            ^~~~~~~
      |            dswitch