Submission #546155

# Submission time Handle Problem Language Result Execution time Memory
546155 2022-04-06T14:36:20 Z luka1234 Super Dango Maker (JOI22_dango3) C++17
100 / 100
4005 ms 776 KB
#include "dango3.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
namespace {
	vector<int> ans[26];
} 
bool check(int n,int m,vector<int> vec,int f){
	if(vec.size()==0)
	   return 0;
	if(vec.size()==n)
	   return 1;
	vec.push_back(f);
	vector<int> v;
	int ind=0;
	for(int k=1;k<=n*m;k++){
		if(ind<vec.size()&&vec[ind]==k){
			ind++;
		}
		else{
			v.push_back(k);
		}
	}
	int x=Query(v);
	if(x<=m-2)
	   return 1;
	else
	   return 0;
}
void Solve(int N, int M){
	int l=1,r=M,md;
	bool bl;
	for(int k=1;k<=N*M;k++){
		l=1;
		r=M;
		while(l<r){
			md=(l+r)/2;
			bl=check(N,M,ans[md],k);
			if(bl==0)
			   r=md;
			else
			   l=md+1;
		}
		ans[l].push_back(k);
	}
	for(int k=1;k<=M;k++){
		Answer(ans[k]);
	}
}

Compilation message

dango3.cpp: In function 'bool check(int, int, std::vector<int>, int)':
dango3.cpp:11:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |  if(vec.size()==n)
      |     ~~~~~~~~~~^~~
dango3.cpp:17:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   if(ind<vec.size()&&vec[ind]==k){
      |      ~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 388 KB Output is correct
2 Correct 26 ms 392 KB Output is correct
3 Correct 30 ms 364 KB Output is correct
4 Correct 29 ms 340 KB Output is correct
5 Correct 12 ms 380 KB Output is correct
6 Correct 16 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 874 ms 716 KB Output is correct
2 Correct 857 ms 600 KB Output is correct
3 Correct 1008 ms 596 KB Output is correct
4 Correct 978 ms 492 KB Output is correct
5 Correct 475 ms 488 KB Output is correct
6 Correct 471 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3417 ms 776 KB Output is correct
2 Correct 3462 ms 748 KB Output is correct
3 Correct 3905 ms 764 KB Output is correct
4 Correct 4005 ms 640 KB Output is correct
5 Correct 1875 ms 708 KB Output is correct
6 Correct 1515 ms 580 KB Output is correct