제출 #905935

#제출 시각아이디문제언어결과실행 시간메모리
905935Tuanlinh123Super Dango Maker (JOI22_dango3)C++17
100 / 100
2243 ms1104 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...