Submission #951645

# Submission time Handle Problem Language Result Execution time Memory
951645 2024-03-22T08:41:06 Z pcc Super Dango Maker (JOI22_dango3) C++17
7 / 100
10000 ms 23472 KB
#include "dango3.h"

#include <bits/stdc++.h>
#include <vector>
using namespace std;

namespace {

const int mxn = 1e5+10;
vector<int> perm;
bitset<mxn> done;

int ask(vector<int> vv){
	for(auto &i:vv)i = perm[i];
	cerr<<"ASK:";for(auto &i:vv)cerr<<i<<' ';cerr<<endl;
	return Query(vv);
}

}  // namespace
/*
std::vector<int> x(3);
x[0] = 1;
x[1] = 2;
x[2] = 3;
variable_example = Query(x);
for (int i = 0; i < M; i++) {
std::vector<int> a(N);
for (int j = 0; j < N; j++) {
  a[j] = N * i + j + 1;
}
Answer(a);
}
*/


void Solve(int N, int M) {
	perm.push_back(0);
	for(int i = 1;i<=N*M;i++)perm.push_back(i);
	mt19937 seed(time(NULL));
	shuffle(perm.begin()+1,perm.end(),seed);
	for(int i = 1;i<=M;i++){
		vector<int> v;
		for(int j = 1;j<=N*M;j++){
			if(done[j])continue;
			v.push_back(j);
			if(ask(v) != 0)break;
		}
		while(v.size()>N){
			auto tmp = v.back();
			v.pop_back();
			if(ask(v) == 0)v.insert(v.begin(),tmp);
			for(auto &j:v)cerr<<j<<' ';cerr<<endl;
		}
		for(auto &j:v)done[j] = true;
		cerr<<"ANS:";for(auto &j:v)cerr<<j<<' ';cerr<<endl;
		for(auto &j:v)j = perm[j];
		Answer(v);
	}
	return;
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:48:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   48 |   while(v.size()>N){
      |         ~~~~~~~~^~
dango3.cpp:52:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   52 |    for(auto &j:v)cerr<<j<<' ';cerr<<endl;
      |    ^~~
dango3.cpp:52:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   52 |    for(auto &j:v)cerr<<j<<' ';cerr<<endl;
      |                               ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 440 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4523 ms 8848 KB Output is correct
2 Correct 3782 ms 7200 KB Output is correct
3 Correct 4130 ms 8080 KB Output is correct
4 Correct 4369 ms 8420 KB Output is correct
5 Correct 4473 ms 8224 KB Output is correct
6 Correct 5187 ms 9988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 10097 ms 21896 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 10072 ms 23472 KB Time limit exceeded
2 Halted 0 ms 0 KB -