#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]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
348 KB |
Output is correct |
2 |
Correct |
12 ms |
348 KB |
Output is correct |
3 |
Correct |
15 ms |
508 KB |
Output is correct |
4 |
Correct |
15 ms |
348 KB |
Output is correct |
5 |
Correct |
11 ms |
512 KB |
Output is correct |
6 |
Correct |
11 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
393 ms |
592 KB |
Output is correct |
2 |
Correct |
389 ms |
596 KB |
Output is correct |
3 |
Correct |
503 ms |
816 KB |
Output is correct |
4 |
Correct |
510 ms |
612 KB |
Output is correct |
5 |
Correct |
330 ms |
564 KB |
Output is correct |
6 |
Correct |
327 ms |
572 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1797 ms |
680 KB |
Output is correct |
2 |
Correct |
1533 ms |
716 KB |
Output is correct |
3 |
Correct |
1994 ms |
760 KB |
Output is correct |
4 |
Correct |
1991 ms |
984 KB |
Output is correct |
5 |
Correct |
1290 ms |
696 KB |
Output is correct |
6 |
Correct |
1309 ms |
924 KB |
Output is correct |