제출 #519250

#제출 시각아이디문제언어결과실행 시간메모리
519250Jomnoi동굴 (IOI13_cave)C++17
0 / 100
521 ms432 KiB
#include <bits/stdc++.h> #include "cave.h" #define DEBUG 0 using namespace std; const int MX = 5e3 + 10; int S[MX], D[MX], res, res1; bool up; int l, r, pos; vector <int> vec, tmp; void exploreCave(int N) { for(int i = 0; i < N; i++) { vec.push_back(i); } for(int i = 0; i < N; i++) { for(auto v : vec) { S[v] = 0; } res1 = tryCombination(S); up = (res1 == i); l = 0, r = vec.size() - 1, pos; while(l <= r) { int mid = (l + r) / 2; for(int j = 0; j <= mid; j++) { S[vec[j]] = up; } for(int j = mid + 1; j < vec.size(); j++) { S[vec[j]] = up ^ 1; } if(tryCombination(S) == i) { l = mid + 1; } else { pos = mid; r = mid - 1; } } tmp.clear(); for(int i = 0; i < pos; i++) { tmp.push_back(vec[i]); } for(int i = pos + 1; i < vec.size(); i++) { tmp.push_back(vec[i]); } vec = tmp; S[pos] = up; D[pos] = i; } answer(S, D); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:39: warning: right operand of comma operator has no effect [-Wunused-value]
   24 |         l = 0, r = vec.size() - 1, pos;
      |                                       ^
cave.cpp:31:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |             for(int j = mid + 1; j < vec.size(); j++) {
      |                                  ~~^~~~~~~~~~~~
cave.cpp:48:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         for(int i = pos + 1; i < vec.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...