Submission #605555

# Submission time Handle Problem Language Result Execution time Memory
605555 2022-07-25T18:51:49 Z MohamedAhmed04 Super Dango Maker (JOI22_dango3) C++17
Compilation error
0 ms 0 KB
#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]) ;
}

Compilation message

dango3.cpp: In function 'bool check(int, int)':
dango3.cpp:28:22: error: 'M' was not declared in this scope
   28 |  return (Query(v) == M-2) ;
      |                      ^