제출 #72703

#제출 시각아이디문제언어결과실행 시간메모리
72703RezwanArefin01동굴 (IOI13_cave)C++17
100 / 100
845 ms652 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int get(int S[]) { int x = tryCombination(S); if(x == -1) x = 1e9; return x; } void exploreCave(int N) { int S[N], D[N]; memset(S, 0, sizeof S); vector<pair<int, int> > v; for(int i = 0; i < N; i++) { int b = get(S) <= i; int l = 0, r = N - 1; while(l < r) { int m = l + r >> 1; int Q[N]; memset(Q, -1, sizeof Q); for(auto it : v) Q[it.first] = it.second; for(int i = l; i <= m; i++) if(Q[i] == -1) Q[i] = b; for(int i = m + 1; i <= r; i++) if(Q[i] == -1) Q[i] = b ^ 1; if(get(Q) > i) r = m; else l = m + 1; } v.emplace_back(l, b); S[l] = b; D[l] = i; } answer(S, D); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
             int m = l + r >> 1; 
                     ~~^~~
#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...