Submission #945013

#TimeUsernameProblemLanguageResultExecution timeMemory
945013siewjhChameleon's Love (JOI20_chameleon)C++17
4 / 100
7 ms596 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; namespace { } // namespace void Solve(int N) { set<int> unp; unp.insert(1); for (int i = 2; i <= 2 * N; i++){ vector<int> vec; for (int x : unp) vec.push_back(x); vec.push_back(i); int amt = Query(vec); vec.pop_back(); if (amt == unp.size()){ int sz = vec.size(), l = 0, r = sz - 1; while (l < r){ int m = (l + r) >> 1; vector<int> qvec; for (int j = l; j <= m; j++) qvec.push_back(vec[j]); qvec.push_back(i); if (Query(qvec) == qvec.size()) l = m + 1; else r = m; } Answer(i, vec[r]); unp.erase(vec[r]); } else unp.insert(i); } }

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:17:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   if (amt == unp.size()){
      |       ~~~~^~~~~~~~~~~~~
chameleon.cpp:24:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     if (Query(qvec) == qvec.size()) l = m + 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...