제출 #256534

#제출 시각아이디문제언어결과실행 시간메모리
256534Harry464동굴 (IOI13_cave)C++14
0 / 100
1120 ms532 KiB
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <cstring> #include "cave.h" using namespace std; void exploreCave(int n) { vector <int> sw(n,0); vector <int> odg(n,-1); for (int j = 0; j < n; j++){ vector <int> t = sw; vector <int> free; for (int i = 0; i < n; i++) if (odg[i] == -1) free.push_back(i), t[i] = 1; int ask = tryCombination(&t[0]); int trig; if (ask == j) trig = 0; else trig = 1; int l = 0, r = free.size() - 1; while (l < r){ int mid = (l+r)/2; for (int i = l; i <= mid; i++) t[free[i]] = trig; for (int i = 0; i < l; i++) t[free[i]] = (trig+1)%2; for (int i = mid + 1; i < free.size(); i++) t[free[i]] = (trig+1)%2; ask = tryCombination(&t[0]); if (ask == j) l = mid + 1; else r = mid; } sw[l] = trig; odg[l] = j; } answer(&sw[0],&odg[0]); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:33:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for (int i = mid + 1; i < free.size(); i++)
                                   ~~^~~~~~~~~~~~~
#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...