제출 #161618

#제출 시각아이디문제언어결과실행 시간메모리
161618kostia244동굴 (IOI13_cave)C++14
64 / 100
984 ms512 KiB
#include "cave.h" #include<bits/stdc++.h> const int maxn = 5051; int n; int S[maxn], D[maxn]; void fill(int v, int q) { int c = 0; for(int i = 0;i < n&&c<q; i++) { if(D[i]==-1)c++,S[i]=v; } } int get(int x) { int i = 0, c = 0; while(c < x) { if(D[i]==-1)c++; if(c!=x)i++; } return i; } void blocB() { for (int i = 0; i < n; i++) { S[i] = 1; D[i] = tryCombination(S); S[i] = 0; } answer(S, D); } void exploreCave(int N) { n = N; memset(S, 0, sizeof S); memset(D, -1, sizeof D); if(tryCombination(S)==-1) { blocB(); } int c = 0; int x = 0; for(int i = 0; i < n; i++) { fill(1, n); x = tryCombination(S); if(x>i||x==-1) { x=1; } else { x=0; } int a = 0; for(int j = 1<<12; j; j>>=1) { if(a+j>n)continue; fill(x^1, n); fill(x, a+j); int t = tryCombination(S); if(t<=i&&t!=-1) { a+=j; } } a = get(a+1); D[a] = i; S[a] = x; } answer(S, D); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:6: warning: unused variable 'c' [-Wunused-variable]
  int c = 0;
      ^
#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...