#include "dango3.h"
#include <bits/stdc++.h>
using namespace std ;
const int MAX = 1e4 + 10 ;
int mark[MAX] ;
int n , m ;
vector<int>ans[30] ;
vector<int>v ;
bool check(int idx , int x)
{
v.clear() ;
memset(mark , 0 , sizeof(mark)) ;
mark[x] = 1 ;
for(auto &i : ans[idx])
mark[i] = 1 ;
vector<int>v ;
for(int i = 1 ; i <= n*m ; ++i)
{
if(!mark[i])
v.push_back(i) ;
}
return (Query(v) == m-2) ;
}
void Solve(int N, int M)
{
n = N , m = M ;
int cnt = 0 ;
for(int i = 1 ; i <= n*m ; ++i)
{
int l = 1 , r = cnt ;
int last = 0 ;
while(l <= r)
{
int mid = (l + r) >> 1 ;
if(check(mid , i))
last = mid , l = mid+1 ;
else
r = mid-1 ;
}
ans[last+1].push_back(i) ;
cnt = max(cnt , last+1) ;
}
for(int i = 1 ; i <= m ; ++i)
Answer(ans[i]) ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
404 KB |
Output is correct |
2 |
Correct |
30 ms |
408 KB |
Output is correct |
3 |
Correct |
35 ms |
340 KB |
Output is correct |
4 |
Correct |
33 ms |
340 KB |
Output is correct |
5 |
Correct |
27 ms |
404 KB |
Output is correct |
6 |
Correct |
27 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
926 ms |
508 KB |
Output is correct |
2 |
Correct |
840 ms |
608 KB |
Output is correct |
3 |
Correct |
1020 ms |
636 KB |
Output is correct |
4 |
Correct |
968 ms |
508 KB |
Output is correct |
5 |
Correct |
737 ms |
492 KB |
Output is correct |
6 |
Correct |
732 ms |
620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3582 ms |
564 KB |
Output is correct |
2 |
Correct |
3254 ms |
584 KB |
Output is correct |
3 |
Correct |
3923 ms |
720 KB |
Output is correct |
4 |
Correct |
3575 ms |
648 KB |
Output is correct |
5 |
Correct |
2989 ms |
628 KB |
Output is correct |
6 |
Correct |
2980 ms |
628 KB |
Output is correct |