Submission #898686

#TimeUsernameProblemLanguageResultExecution timeMemory
898686Darren0724Minerals (JOI19_minerals)C++17
40 / 100
20 ms2648 KiB
#include "minerals.h" #include <bits/stdc++.h> using namespace std; //Query(int) //Answer(int,int) void dc(vector<int> &a,vector<int> &b){ int n=a.size(); if(n==1){ Answer(a[0],b[0]); return; } int m=n/2; int now=0; for(int i=m;i<n;i++){ now=Query(a[i]); } vector<int> a1,a2,b1,b2; for(int i=0;i<m;i++){ a1.push_back(a[i]); } for(int i=m;i<n;i++){ a2.push_back(a[i]); } for(int i=0;i<n;i++){ int t=Query(b[i]); if(t==now){ b1.push_back(b[i]); } else{ b2.push_back(b[i]); } now=t; } for(int j:b1){ Query(j); } dc(a1,b1); dc(b2,a2); } void Solve(int n) { int now=0; vector<int> a,b; for(int i=1;i<=n*2;i++){ int t=Query(i); if(t==now){ b.push_back(i); Query(i); } else{ a.push_back(i); } now=t; } dc(a,b); }
#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...