Submission #947103

#TimeUsernameProblemLanguageResultExecution timeMemory
947103onepunchac168Minerals (JOI19_minerals)C++14
100 / 100
59 ms4248 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; #define pb push_back mt19937 mt(197797777); int tmp=0; bool query(int x) { int rr=Query(x); bool ok; if (rr!=tmp) { ok=false; } else ok=true; tmp=rr; return ok; } void solve(vector <int> left,vector <int> right,bool check) { if (left.empty()) { return; } if (left.size()==1&&right.size()==1) { //cerr<<left[0]<<" "<<right[0]<<" ok"<<endl; Answer(left[0],right[0]); return; } int mid=int(left.size()*0.36)+1; //cerr<<left.size()<<" "<<right.size()<<endl; shuffle (left.begin(),left.end(),mt); shuffle (right.begin(),right.end(),mt); if (check==1) { mid=left.size()-mid; for (int i=mid;i<=left.size()-1;i++) { query(left[i]); } } else { for (int i=0;i<mid;i++) { query(left[i]); } } vector<int> lefta,leftb,righta,rightb; for (auto v:right) { if (righta.size()==mid) { rightb.pb(v); } else if (rightb.size()==right.size()-mid) { righta.pb(v); } else if (query(v)==true) { righta.pb(v); } else rightb.pb(v); } for (int i=0;i<mid;i++) { lefta.pb(left[i]); } for (int i=mid;i<left.size();i++) { leftb.pb(left[i]); } solve(lefta,righta,1); solve(leftb,rightb,0); } void Solve(int n) { vector <int > opt; vector <int> left,right; for (int i=1;i<=2*n;i++) { if (query(i)==false) { left.pb(i); } else right.pb(i); } solve(left,right,1); }

Compilation message (stderr)

minerals.cpp: In function 'void solve(std::vector<int>, std::vector<int>, bool)':
minerals.cpp:40:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         for (int i=mid;i<=left.size()-1;i++)
      |                        ~^~~~~~~~~~~~~~~
minerals.cpp:55:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   55 |         if (righta.size()==mid)
      |             ~~~~~~~~~~~~~^~~~~
minerals.cpp:73:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     for (int i=mid;i<left.size();i++)
      |                    ~^~~~~~~~~~~~
#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...