제출 #291197

#제출 시각아이디문제언어결과실행 시간메모리
291197Ruba_K동굴 (IOI13_cave)C++14
0 / 100
578 ms500 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std ; void exploreCave(int N) { int constant[N] , arr[N] , pos[N]; memset(constant , 0 , sizeof constant); for(int i = 0 ; i < N ; i ++) arr[i] = i % 2 ; for(int i = 0 ; i < N ; i ++){ int ret = tryCombination(arr); if(ret != i){ for(int j = 0 ; j < N ; j ++){ if(constant[j])continue ; arr[j] = (arr[j] + 1 ) % 2 ; } } int l = 0 , r = N - 1 , md ; while(l < r){ md = (l + r) / 2 ; int check[N]; for(int j = 0 ; j < N ; j ++){ if(constant[j])check[j] = arr[j]; else check[j] = (j >= l && j <= md ? arr[j] : arr[j] ^ 1); } ret = tryCombination(check); if(ret == i)r = md ; else l = md + 1 ; } constant[l] = 1 ; arr[l] ^= 1 ; pos[l] = i ; } }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:6:32: warning: variable 'pos' set but not used [-Wunused-but-set-variable]
    6 |     int constant[N] , arr[N] , pos[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...