# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764386 | Dan4Life | Minerals (JOI19_minerals) | C++17 | 40 ms | 3364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "minerals.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define pb push_back
#define sz(a) (int)a.size()
int cur, pre;
bool Q(int i){ cur = Query(i); bool ok=(cur!=pre); pre=cur; return ok;}
void dnc(vi l, vi r, bool d){
int n = sz(l); int m = n*.4+.5;
if(n==1) return Answer(l[0],r[0]);
if(!d) m=n-m; vi w[2]={{},{}};
for(int i = (d?0:m); i < (d?m:n); i++) Q(l[i]);
random_shuffle(begin(r),end(r));
for(int i : r) w[sz(w[0])==m?1:sz(w[1])==n-m?0:Q(i)].pb(i);
dnc(vi(begin(l),begin(l)+m),w[0],0);
dnc(vi(begin(l)+m,end(l)),w[1],1);
}
void Solve(int N) {
vi w[2];
for(int i = 1; i <= 2*N; i++) w[Q(i)].pb(i);
dnc(w[0],w[1],0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |