Submission #448722

#TimeUsernameProblemLanguageResultExecution timeMemory
448722kimjg1119Chameleon's Love (JOI20_chameleon)C++17
4 / 100
31 ms312 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; for(int i=1;i<=N*2;i++){ if(!mchk[i]) v.push_back(i); if(v.size() == mid) break; } int ret1 = Query(v); v.push_back(x); int ret2 = Query(v); if(ret1 == ret2){ 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:19:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   19 |    if(v.size() == mid) 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...