제출 #230050

#제출 시각아이디문제언어결과실행 시간메모리
230050chubyxdxd동굴 (IOI13_cave)C++11
64 / 100
1030 ms632 KiB
#include "cave.h" #include <bits/stdc++.h> #define test tryCombination using namespace std; void exploreCave(int N) { int door[N],ans[N],vis[N]; for(int i=0;i<N;i++){ ans[i]=1; door[i]=-1; vis[i]=1; } //int curr=test(ans); // cout<<curr<<endl; for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ if(vis[j]==1)ans[j]=1; } int h=test(ans); int sw=0; if(h==i){ sw=1; } //cout<<"gg=="<<sw<<endl; for(int j=0;j<N;j++){ if(vis[j]==1)ans[j]=sw; } int lo=0,hi=N-1,r; while(lo<hi){ for(int j=0;j<N;j++){ if(vis[j]==1)ans[j]=sw; } int mid=(lo+hi)/2; for(int j=lo;j<=mid;j++){ if(vis[j]==1)ans[j]^=1; } r=test(ans); //cout<<r<<endl; if(r==i){ lo=mid+1; } else{ hi=mid; } //cout<<lo<<" "<<hi<<endl; } door[lo]=i; vis[lo]=-1; if(r==i)ans[lo]^=1;/* cout<<lo<<" -< "<<endl; cout<<"swich"<<endl; for(int j=0;j<N;j++){ cout<<ans[j]<<" "; } cout<<endl; cout<<"door"<<endl; for(int j=0;j<N;j++){ cout<<door[j]<<" "; } cout<<endl; cout<<"off"<<endl; for(int j=0;j<N;j++){ cout<<vis[j]<<" "; } cout<<endl;*/ } answer(ans,door); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:48:5: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
     if(r==i)ans[lo]^=1;/*
     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...