Submission #551888

# Submission time Handle Problem Language Result Execution time Memory
551888 2022-04-21T19:59:08 Z Antekb Super Dango Maker (JOI22_dango3) C++17
100 / 100
446 ms 712 KB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
namespace{

}
void Solve(int N, int M) {
	vector<int> V(N*M);
	for(int i=0; i<N*M; i++){
		V[i]=i+1;
	}
	for(int j=0; j<M; j++){
		shuffle(V.begin(), V.end(), rng);
		vector<int> V2;
		int l=1, r=V.size();
		while(l<r){
			int m=(l+r)>>1;
			V2=V;
			V2.resize(m);
			if(Query(V2))r=m;
			else l=m+1;
		}
		V2.clear();
		vector<int> V3;
		while(V.size()>l){
			V3.push_back(V.back());
			V.pop_back();
		}
		while(V.size()){
			int x=V.back();
			V.pop_back();
			//cerr<<V.size()<<"a\n";
			for(int i:V2)V.push_back(i);
			//cerr<<V.size()<<"a\n";
			int b=Query(V);
			//cerr<<V.size()<<"a\n";
			for(int i:V2)V.pop_back();
			//cerr<<V.size()<<"a\n";
			if(!b)V2.push_back(x);
			else V3.push_back(x);
		}
		assert(V2.size()==N);
		Answer(V2);
		V=V3;
	}
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:26:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   26 |   while(V.size()>l){
      |         ~~~~~~~~^~
dango3.cpp:38:12: warning: unused variable 'i' [-Wunused-variable]
   38 |    for(int i:V2)V.pop_back();
      |            ^
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from dango3.cpp:2:
dango3.cpp:43:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |   assert(V2.size()==N);
      |          ~~~~~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 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 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 316 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
6 Correct 4 ms 380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 472 KB Output is correct
2 Correct 72 ms 476 KB Output is correct
3 Correct 70 ms 468 KB Output is correct
4 Correct 72 ms 472 KB Output is correct
5 Correct 79 ms 476 KB Output is correct
6 Correct 70 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 389 ms 712 KB Output is correct
2 Correct 422 ms 612 KB Output is correct
3 Correct 393 ms 704 KB Output is correct
4 Correct 433 ms 604 KB Output is correct
5 Correct 446 ms 600 KB Output is correct
6 Correct 375 ms 600 KB Output is correct