Submission #668035

#TimeUsernameProblemLanguageResultExecution timeMemory
668035finn__동굴 (IOI13_cave)C++17
13 / 100
754 ms436 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n) { int p[n]; vector<int> x(n); for (size_t i = 0; i < n; i++) x[i] = i; int comb[n]; fill(comb, comb + n, 0); for (size_t i = 0; i < n; i++) { // First determine wheter the next switch must be on or off. bool next_on = (tryCombination(comb) == i); size_t a = 0, b = n - i - 1; while (a < b) { size_t mid = (a + b) / 2; for (size_t j = 0; j <= mid; j++) comb[x[j]] = !next_on; if (tryCombination(comb) == i) b = mid; else a = mid + 1; for (size_t j = 0; j <= mid; j++) comb[x[j]] = next_on; } p[x[a]] = i; comb[x[a]] = next_on; x.erase(x.begin() + a); } answer(comb, p); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:9:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
    9 |     for (size_t i = 0; i < n; i++)
      |                        ~~^~~
cave.cpp:15:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   15 |     for (size_t i = 0; i < n; i++)
      |                        ~~^~~
cave.cpp:18:46: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         bool next_on = (tryCombination(comb) == i);
      |                         ~~~~~~~~~~~~~~~~~~~~~^~~~
cave.cpp:28:38: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if (tryCombination(comb) == 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...