#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 time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
5 ms |
344 KB |
Output is correct |
3 |
Correct |
17 ms |
344 KB |
Output is correct |
4 |
Correct |
64 ms |
652 KB |
Output is correct |
5 |
Correct |
255 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [5] |
2 |
Halted |
0 ms |
0 KB |
- |