Submission #1072699

#TimeUsernameProblemLanguageResultExecution timeMemory
1072699SiliconSquaredMinerals (JOI19_minerals)C++14
0 / 100
1 ms344 KiB
#include "minerals.h" using namespace std; #include <vector> int query(int x){return Query(x+1);} int n; struct mineral{ int a,b; mineral(){a=0;b=n;} }; vector<mineral> v; void f(int a,int b){ for (int i=a;i<b;i++){ query(i); } for (int i=0;i<n;i++){ if (v[i].a<=a && v[i].b>=b){ if (query(i+n)>(b-a)){ v[i].a=b; }else{ v[i].b=b; } query(i+n); } } for (int i=a;i<b;i++){ query(i); } } void Solve(int N) { n=N; v.resize(n,mineral()); vector<pair<int,int>> w; w.push_back({0,N/2}); int a,b; while (!w.empty()){ a=w[w.size()-1].first; b=w[w.size()-1].second; w.pop_back(); if (a==b){continue;} f(a,b); w.push_back({a,(a+b)/2}); w.push_back({b,b+(b-a)/2}); } for (int i=0;i<n;i++){ Answer(i+n+1,v[i].a+1); } }
#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...