제출 #1072720

#제출 시각아이디문제언어결과실행 시간메모리
1072720boyliguanhanMinerals (JOI19_minerals)C++17
100 / 100
324 ms8432 KiB
#include "minerals.h" #include<bits/stdc++.h> using namespace std; set<int>st; int query(int k){ if(st.count(k)) st.erase(k); else st.insert(k); return Query(k); } mt19937 rng(random_device{}()); void solve(vector<int>A,vector<int>B,int dep){ if(A.size()==1) return Answer(A[0],B[0]); vector<int>A1,A2; vector<int>B1,B2; int CC=0; for(auto i:A) (CC++%3?A2:A1).push_back(i); int prv=0; for(auto i:A1) prv=query(i); shuffle(B.begin(),B.end(),rng); for(auto i:B) { if(A1.size()==B1.size()){ B2.push_back(i); continue; } else if(A2.size()==B2.size()){ B1.push_back(i); continue; } int x=query(i); if(st.count(A1[0])^(x==prv)) B2.push_back(i); else B1.push_back(i); prv=x; } solve(A1,B1,dep^1); solve(A2,B2,dep^1); } void Solve(int N) { vector<int>A,B; int prv=0; vector<int>VV(2*N); iota(VV.begin(),VV.end(),1); shuffle(VV.begin(),VV.end(),rng); for(auto i:VV) { if(A.size()==N){ B.push_back(i); continue; } else if(B.size()==N){ A.push_back(i); continue; } if(query(i)!=prv) A.push_back(i),prv++; else B.push_back(i); } solve(A,B,0); }

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

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:47:16: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |     if(A.size()==N){
      |        ~~~~~~~~^~~
minerals.cpp:50:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |     } else if(B.size()==N){
      |               ~~~~~~~~^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...