Submission #869637

# Submission time Handle Problem Language Result Execution time Memory
869637 2023-11-05T06:57:05 Z willychan Super Dango Maker (JOI22_dango3) C++17
7 / 100
1206 ms 956 KB
#include "dango3.h"

#include <vector>
#include<random>
#include<algorithm>
#include<iostream>
#include<cassert>
using namespace std;
namespace {

int variable_example = 1;
int n,m;
}  // namespace

void process(vector<int> &get,vector<int> &pos){
	int k = pos.size();
	random_shuffle(pos.begin(),pos.end());
	vector<int> a;
	for(int i=1;i<k;i++) a.push_back(pos[i]);
	vector<bool> notin(k,0);
	notin[0]=1;
	int should = (k/n)-1;
	for(int i=1;i<k;i++){
		notin[i]=1;
		vector<int> q;		
		for(int i=0;i<k;i++) if(!notin[i]) q.push_back(pos[i]);
		int g = Query(q);
		if(g!=should) notin[i]=0;
	}
	for(int i=0;i<k;i++) if(notin[i]) get.push_back(pos[i]);
}
void Solve(int N, int M) {
	n = N;m = M;
	vector<int> pos(N*M);
	vector<bool> in(N*M+1);
	for(int i=0;i<N*M;i++) pos[i] = i+1;
	for(int i=0;i<M-1;i++){
		vector<int> get;
		process(get,pos);
		for(auto i : get) in[i]=1;
		assert(get.size()==n);
		Answer(get);
		vector<int> temp;
		for(auto i : pos) if(!in[i]) temp.push_back(i);
		swap(pos,temp);
	}
	Answer(pos);
	/*for(auto i : pos) ans.push_back(i);
	for(int i=0;i<M;i++){
		vector<int> ret;
		for(int j=0;j<N;j++){
			ret.push_back(ans[j*N+i]);
		}
		Answer(ret);
	}*/
}

Compilation message

In file included from /usr/include/c++/10/cassert:44,
                 from dango3.cpp:7:
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:41:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   41 |   assert(get.size()==n);
      |          ~~~~~~~~~~^~~
dango3.cpp: At global scope:
dango3.cpp:11:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
   11 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 508 KB Output is correct
2 Correct 12 ms 348 KB Output is correct
3 Correct 12 ms 344 KB Output is correct
4 Correct 12 ms 348 KB Output is correct
5 Correct 12 ms 512 KB Output is correct
6 Correct 12 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 569 ms 640 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1206 ms 956 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -