Submission #710405

#TimeUsernameProblemLanguageResultExecution timeMemory
710405Darren0724Minerals (JOI19_minerals)C++17
25 / 100
10 ms976 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(int a,int b,vector<int> &c){ //cout<<a<<' '<<b<<' '<<c.size()<<endl; if(b-a==1){ v[a]=c[0]; return; } int t=0; int m=(a+b)>>1; for(int i=a;i<m;i++){ t=Query(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=a;i<m;i++){ t=Query(i); } dc(a,m,c1); dc(m,b,c2); } void Solve(int N) { n=N; v.resize(N*2+1,-1); vector<int> c; for(int i=N+1;i<=N*2;i++){ c.push_back(i); } dc(1,N+1,c); for(int i=1;i<=n;i++){ Answer(i,v[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...