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"
//#include "grader.cpp"
using namespace std;
int nn,mm;
vector<int> chains[35];
bool bad[10005];
bool f[10005];
bool have(int x,int l,int r)
{
bad[x]=1;
for(int i=l;i<=r;i++)
for(int j:chains[i])
bad[j]=1;
vector<int> v;
for(int i=1;i<=nn*mm;i++)
{
if(!bad[i])
v.push_back(i);
else
bad[i]=0;
}
int rez=Query(v);
return rez==mm-(r-l+2);
}
void Solve(int n,int m)
{
nn=n;
mm=m;
chains[1].push_back(1);
int lanturi=1;
for(int i=2;i<=n*m;i++)
{
int st=1;
int dr=lanturi;
int where=0;
while(st<=dr)
{
int mij=(st+dr)/2;
if(have(i,1,mij))
{
where=mij;
st=mij+1;
}
else
dr=mij-1;
}
where++;
lanturi=max(lanturi,where);
chains[where].push_back(i);
}
for(int z=1;z<=m;z++)
Answer(chains[z]);
}
# | 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... |