#include "dango3.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
mt19937 rng(170306);
ll n, m;
bool check[10005];
vector <ll> a[26];
ll query(vector <ll> a)
{
vector <ll> res;
for (ll i:a) check[i]=1;
for (ll i=1; i<=n*m; i++)
if (!check[i])
res.pb(i);
for (ll i:a) check[i]=0;
return n-Query(res);
}
void Solve(ll N, ll M)
{
n=M, m=N;
for (ll i=1; i<=n*m; i++)
{
ll lo=1, hi=n;
while (hi>lo)
{
ll mid=(lo+hi)/2;
vector <ll> num; num.pb(i);
for (ll j=1; j<=mid; j++)
num.insert(num.end(), a[j].begin(), a[j].end());
if (query(num)>mid) lo=mid+1;
else hi=mid;
}
a[lo].pb(i);
}
for (ll i=1; i<=n; i++)
Answer(a[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
572 KB |
Output is correct |
2 |
Correct |
16 ms |
344 KB |
Output is correct |
3 |
Correct |
16 ms |
344 KB |
Output is correct |
4 |
Correct |
17 ms |
552 KB |
Output is correct |
5 |
Correct |
16 ms |
348 KB |
Output is correct |
6 |
Correct |
16 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
487 ms |
1104 KB |
Output is correct |
2 |
Correct |
484 ms |
848 KB |
Output is correct |
3 |
Correct |
531 ms |
692 KB |
Output is correct |
4 |
Correct |
538 ms |
688 KB |
Output is correct |
5 |
Correct |
491 ms |
900 KB |
Output is correct |
6 |
Correct |
482 ms |
912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2033 ms |
768 KB |
Output is correct |
2 |
Correct |
2004 ms |
880 KB |
Output is correct |
3 |
Correct |
2236 ms |
1008 KB |
Output is correct |
4 |
Correct |
2243 ms |
1052 KB |
Output is correct |
5 |
Correct |
1991 ms |
784 KB |
Output is correct |
6 |
Correct |
1957 ms |
916 KB |
Output is correct |