Submission #901274

#TimeUsernameProblemLanguageResultExecution timeMemory
901274Darren0724Minerals (JOI19_minerals)C++17
0 / 100
1 ms344 KiB
#include "minerals.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; //Query(int) //Answer(int,int) int last=0; int ask(int k){ int p = Query(k); int tmp = p - last; last = p; return tmp; } 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; for(int i=m;i<n;i++){ ask(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++){ if(ask(b[i])==0){ b1.push_back(b[i]); } else{ b2.push_back(b[i]); } } dc(a1,b1); dc(b2,a2); } void Solve(int n) { vector<int> a,b; for(int i=1;i<=n*2;i++){ if(ask(i)==0){ b.push_back(i); } else{ a.push_back(i); } } for(int i:b){ ask(i); } 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...