제출 #99803

#제출 시각아이디문제언어결과실행 시간메모리
99803MohamedAhmed0동굴 (IOI13_cave)C++14
100 / 100
440 ms640 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std ; const int MAX = 5005 ; int s[MAX] , d[MAX] , arr[MAX] , last , done[MAX]; int now ; bool check(int l , int mid) { for(int i = l ; i <= mid ; ++i) { if(done[i]) continue ; s[i] = !s[i] ; } int x = tryCombination(s) ; for(int i = l ; i <= mid ; ++i) { if(done[i]) continue; s[i] = !s[i] ; } if(x > now || x == -1) return 1 ; return 0 ; } void exploreCave(int N) { memset(s , 0 , sizeof(s)); for(int i = 0 ; i < N ; ++i) { now = i ; bool t = false ; last = tryCombination(s) ; if(last > i || last == -1) { for(int j = 0 ; j < N ; ++j) { if(done[j]) continue; s[j] = !s[j] ; } } int l = 0 , r = N-1 , ans = N-1; while(l <= r) { int mid = (l + r) / 2 ; if(check(l , mid)) ans = mid , r = mid-1 , t = true; else l = mid+1 ; } d[ans] = i ; done[ans] = 1 ; s[ans] = !s[ans] ; } answer(s , d) ; }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:14: warning: variable 't' set but not used [-Wunused-but-set-variable]
         bool t = false ;
              ^
#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...