제출 #709017

#제출 시각아이디문제언어결과실행 시간메모리
709017aggrovector동굴 (IOI13_cave)C++17
0 / 100
591 ms1296 KiB
#ifndef __CAVE_H__ #define __CAVE_H__ #ifdef __cplusplus extern "C" { #endif int tryCombination(int S[]); void answer(int S[], int D[]); void exploreCave(int N); #ifdef __cplusplus } #endif #include <bits/stdc++.h> using namespace std; int i,l,r,x,mid,unlocked,type,y,j; void exploreCave(int N) { int s[N],d[N],vi[N],anss[N],ansd[N]; for (i=0;i<N;i++) { s[i]=0; vi[i]=0; anss[i]=0; ansd[i]=0; } for (j=0;j<N;j++) { for (i=0;i<N;i++) { if (vi[i]==1) { s[i]=anss[i]; } else { s[i]=0; } } x=tryCombination(s); if (x==-1) { x=N; } if (x<=j) { //jth door is closed when switch is 0 type=1; } else { //jth door is open when switch is 0 for (i=0;i<N;i++) { if (vi[i]==1) { s[i]=anss[i]; } else { s[i]=1; } } type=2; x=j; } l=0; r=N-1; while(l<r) { printf("l,r: %d %d\n",l,r); mid=(l+r)/2; for (i=0;i<=mid;i++) { if (vi[i]==0) { if (type==1) { s[i]=1; } else { s[i]=0; } } } y=tryCombination(s); if (y==-1) { y=N; } for (i=0;i<N;i++) { if (vi[i]==0) { if (type==1) { s[i]=0; } else { s[i]=1; } } } if (y==x) { l=mid+1; } else { r=mid; } } vi[l]=1; ansd[l]=j; if (type==1) { anss[l]=1; } else { anss[l]=0; } } answer(anss,ansd); } #endif /* __CAVE_H__ */

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:14: warning: unused variable 'd' [-Wunused-variable]
   21 |     int s[N],d[N],vi[N],anss[N],ansd[N];
      |              ^
#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...