답안 #951666

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
951666 2024-03-22T09:19:34 Z pcc Super Dango Maker (JOI22_dango3) C++17
22 / 100
187 ms 856 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) {
	for(int i = 0;i<=N*M;i++)perm.push_back(i);
	mt19937 seed(7124);
	shuffle(perm.begin()+1,perm.end(),seed);
	vector<int> v,v2;
	for(int i = 1;i<=M;i++){
		v = v2;
		v2.clear();
		for(int j = 1;j<=N*M;j++){
			if(done[j]||find(v.begin(),v.end(),j) != v.end())continue;
			v.push_back(j);
			if(v.size()<N)continue;
			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);
			else v2.push_back(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:47:15: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |    if(v.size()<N)continue;
      |       ~~~~~~~~^~
dango3.cpp:50:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |   while(v.size()>N){
      |         ~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 5 ms 552 KB Output is correct
6 Correct 4 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 604 KB Output is correct
2 Correct 63 ms 344 KB Output is correct
3 Correct 52 ms 348 KB Output is correct
4 Correct 52 ms 348 KB Output is correct
5 Correct 57 ms 596 KB Output is correct
6 Correct 60 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 187 ms 856 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -