제출 #722490

#제출 시각아이디문제언어결과실행 시간메모리
722490alvingogo카멜레온의 사랑 (JOI20_chameleon)C++14
4 / 100
56 ms340 KiB
#include "chameleon.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; namespace { int variable_example = 1; int n; } // namespace bool find(int x,int y){ vector<int> g; for(int i=1;i<=n;i++){ if(i==x || i==y){ continue; } g.push_back(i); } int z=Query(g); return z==(n/2-1); } mt19937 rnd(time(NULL)); void Solve(int N) { n=2*N; vector<int> tt(n); iota(tt.begin(),tt.end(),1); while(tt.size()>2){ shuffle(tt.begin(),tt.end(),rnd); vector<int> s,t; for(auto h:tt){ if(!s.size()){ s.push_back(h); continue; } s.push_back(h); if(Query(s)==s.size()){ continue; } s.pop_back(); cerr << h << "\n"; int l=0,r=((int)s.size())-1; while(r>l){ int m=(l+r)/2; vector<int> tmp; for(int i=0;i<=m;i++){ tmp.push_back(s[i]); } tmp.push_back(h); if(Query(tmp)<=(int)tmp.size()-1){ r=m; } else{ l=m+1; } } cerr << s[l] << " " << h << "\n"; if(find(s[l],h)){ Answer(s[l],h); swap(s[l],s.back()); s.pop_back(); } else{ t.push_back(h); } } s.insert(s.end(),t.begin(),t.end()); tt.swap(s); } if(tt.size()){ Answer(tt[0],tt[1]); } }

컴파일 시 표준 에러 (stderr) 메시지

chameleon.cpp: In function 'void Solve(int)':
chameleon.cpp:37:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             if(Query(s)==s.size()){
      |                ~~~~~~~~^~~~~~~~~~
chameleon.cpp: At global scope:
chameleon.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 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...