# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
546155 | luka1234 | Super Dango Maker (JOI22_dango3) | C++17 | 4005 ms | 776 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 "dango3.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
namespace {
vector<int> ans[26];
}
bool check(int n,int m,vector<int> vec,int f){
if(vec.size()==0)
return 0;
if(vec.size()==n)
return 1;
vec.push_back(f);
vector<int> v;
int ind=0;
for(int k=1;k<=n*m;k++){
if(ind<vec.size()&&vec[ind]==k){
ind++;
}
else{
v.push_back(k);
}
}
int x=Query(v);
if(x<=m-2)
return 1;
else
return 0;
}
void Solve(int N, int M){
int l=1,r=M,md;
bool bl;
for(int k=1;k<=N*M;k++){
l=1;
r=M;
while(l<r){
md=(l+r)/2;
bl=check(N,M,ans[md],k);
if(bl==0)
r=md;
else
l=md+1;
}
ans[l].push_back(k);
}
for(int k=1;k<=M;k++){
Answer(ans[k]);
}
}
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... |