# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
926711 | hotboy2703 | Floppy (RMI20_floppy) | C++14 | 0 ms | 0 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 "floplib.h" // DO NOT CHANGE THIS LINE
#include<bits/stdc++.h>
using namespace std;
const int MAXK = 16;
int sp[MAXK][40100];
string ansss;
vector <int> a;
int best(int x,int y){
if (a[x] > a[y])return x;
return y;
}
int lg[40100];
int id=0;
void solve(int l,int r,int node = id++){
if (l > r)return;
int sz = lg[r-l+1];
int mid = best(sp[sz][l],sp[sz][r-(1<<sz)+1]);
ansss[node<<1] = ansss[node<<1|1] = '0';
if (mid > l){
solve(l,mid-1);
ansss[node<<1] = '1';
}
if (mid < r){
ansss[node<<1|1] = '1';
solve(mid+1,r);
}
}