# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900652 | alexander707070 | Super Dango Maker (JOI22_dango3) | C++17 | 671 ms | 1152 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<bits/stdc++.h>
#include "dango3.h"
using namespace std;
int n,m;
int li[10007],tim;
vector<int> v;
void solve(vector<int> el){
if(el.size()==n){
Answer(el); return;
}
int half=(el.size()/n)/2;
vector<int> curr,rest;
deque<int> d;
int l=half*n,r=el.size(),mid;
while(l+1<r){
mid=(l+r)/2;
curr.clear();
for(int p=0;p<mid;p++){
curr.push_back(el[p]);
}
if(Query(curr)>=half){
r=mid;
}else{
l=mid;
}
}
curr.clear();
for(int i=0;i<r;i++)curr.push_back(el[i]);
for(int i:curr)d.push_back(i);
int sz=curr.size(),rem=0;
for(int i=0;i<sz;i++){
rem=d.back();
d.pop_back();
curr={};
for(int f=0;f<d.size();f++){
curr.push_back(d[f]);
}
if(Query(curr)==half)continue;
else d.push_front(rem);
if(int(d.size())==half*n)break;
}
tim++; curr.clear();
for(int i=0;i<d.size();i++){
curr.push_back(d[i]);
li[d[i]]=tim;
}
for(int i=0;i<el.size();i++){
if(li[el[i]]!=tim){
rest.push_back(el[i]);
}
}
solve(curr);
solve(rest);
}
void Solve(int N, int M){
n=N; m=M;
for(int i=1;i<=n*m;i++){
v.push_back(i);
}
solve(v);
}
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... |