Submission #509808

#TimeUsernameProblemLanguageResultExecution timeMemory
509808leinad2Chameleon's Love (JOI20_chameleon)C++17
4 / 100
19 ms336 KiB
#include "chameleon.h" #include<bits/stdc++.h> using namespace std; void Solve(int N) { vector<int>v; for(int i=1;i<=2*N;i++) { if(v.size()==0)v.push_back(i); else { int a=0, b=v.size(); while(a<b) { int m=a+b>>1; vector<int>Q; for(int j=0;j<=m;j++)Q.push_back(v[j]); Q.push_back(i); if(Query(Q)==m+1)b=m; else a=m+1; } if(a==v.size()) { v.push_back(i); continue; } vector<int>V; for(int j=0;j<a;j++)V.push_back(v[j]); for(int j=a+1;j<v.size();j++)V.push_back(v[j]); Answer(v[a], i); v=V; } } }

Compilation message (stderr)

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:15:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   15 |                 int m=a+b>>1;
      |                       ~^~
chameleon.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             if(a==v.size())
      |                ~^~~~~~~~~~
chameleon.cpp:29:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for(int j=a+1;j<v.size();j++)V.push_back(v[j]);
      |                           ~^~~~~~~~~
#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...