Submission #937331

#TimeUsernameProblemLanguageResultExecution timeMemory
937331freedommo33Chameleon's Love (JOI20_chameleon)C++17
0 / 100
1 ms344 KiB
#include "chameleon.h" #include <vector> #include <iostream> using namespace std; // Function to find a pair given one of the chameleons void findPair(int n, int x, vector<bool>& found) { int low = 1, high = 2 * n, mid; while (low < high) { mid = (low + high) / 2; vector<int> query = {x}; for (int i = 1; i <= mid; ++i) { if (!found[i]) query.push_back(i); } int result = Query(query); if (result < query.size()) { high = mid; } else { low = mid + 1; } } Answer(x, low); found[x] = found[low] = true; } void Solve(int N) { vector<bool> found(2 * N + 1, false); for (int i = 1; i <= 2 * N; ++i) { if (!found[i]) { findPair(N, i, found); } } }

Compilation message (stderr)

chameleon.cpp: In function 'void findPair(int, int, std::vector<bool>&)':
chameleon.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if (result < query.size()) {
      |             ~~~~~~~^~~~~~~~~~~~~~
#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...