Submission #710424

#TimeUsernameProblemLanguageResultExecution timeMemory
710424Darren0724Minerals (JOI19_minerals)C++17
40 / 100
30 ms2680 KiB
#include "minerals.h" //#include "grader.cpp" #include<bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int n; vector<int> v; void dc(vector<int> &a,vector<int> &c){ //cout<<a.size()<<' '<<c.size()<<endl; if(a.size()==1){ v[a[0]]=c[0]; return; } int t=0; int m=a.size()/2; for(int i=0;i<m;i++){ t=Query(a[i]); } vector<int> c1,c2; for(int i:c){ int t1=Query(i); if(t1!=t){ Query(i); c2.push_back(i); } else{ c1.push_back(i); } } for(int i:c1){ Query(i); } for(int i=0;i<m;i++){ t=Query(a[i]); } vector<int> a1,a2; for(int i=0;i<m;i++){ a1.push_back(a[i]); } for(int i=m;i<a.size();i++){ a2.push_back(a[i]); } dc(a1,c1); dc(a2,c2); } void Solve(int N) { n=N; vector<int> a; vector<int> c; int t=0; for(int i=1;i<=N*2;i++){ int t1=Query(i); if(t1!=t){ a.push_back(i); t++; } else{ c.push_back(i); Query(i); } } for(int i:a){ Query(i); } v.resize(N*2+1,-1); dc(a,c); for(int i=1;i<=n*2;i++){ if(v[i]!=-1)Answer(i,v[i]); } }

Compilation message (stderr)

minerals.cpp: In function 'void dc(std::vector<int>&, std::vector<int>&)':
minerals.cpp:40:18: 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=m;i<a.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...