Submission #1072707

#TimeUsernameProblemLanguageResultExecution timeMemory
1072707SiliconSquaredMinerals (JOI19_minerals)C++14
25 / 100
255 ms856 KiB
#include "minerals.h" using namespace std; #include <vector> #include <iostream> 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){ //cerr<<a<<','<<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}); int a,b,c; while (!w.empty()){ a=w[w.size()-1].first; b=w[w.size()-1].second; c=(a+b)/2; w.pop_back(); if (a+1==b||a==b){continue;} f(a,c); w.push_back({a,c}); w.push_back({c,b}); } 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...