Submission #448721

#TimeUsernameProblemLanguageResultExecution timeMemory
448721kimjg1119Chameleon's Love (JOI20_chameleon)C++17
0 / 100
1 ms200 KiB
#include "chameleon.h" #include <bits/stdc++.h> using namespace std; int N; vector<int> chk(1010); void f(int x){ int left = 0; for(int i=1;i<=N*2;i++) if(!chk[i]) left++; auto mchk = chk; while(left >= 2){ int mid = left / 2; vector<int> v; v.push_back(x); for(int i=1;i<=N*2;i++){ if(!mchk[i]) v.push_back(i); if(v.size() == mid + 1) break; } int ret = Query(v); if(ret == mid){ int cnt = 0; for(int i=1;i<=N*2;i++){ if(mchk[i]) continue; if(cnt < mid) cnt++; else mchk[i] = 1; } left = mid; } else{ int cnt = 0; for(int i=1;i<=N*2;i++){ if(mchk[i]) continue; cnt++; mchk[i] = 1; if(cnt == mid) break; } left = left - mid; } } for(int i=1;i<=N*2;i++){ if(!mchk[i]){ Answer(x, i); chk[i] = 1; break; } } } void Solve(int n){ N = n; for(int i = 1; i <= N * 2; i++){ if(chk[i]) continue; chk[i] = 1; f(i); } }

Compilation message (stderr)

chameleon.cpp: In function 'void f(int)':
chameleon.cpp:20:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |    if(v.size() == mid + 1) break;
      |       ~~~~~~~~~^~~~~~~~~~
#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...