Submission #1257754

#TimeUsernameProblemLanguageResultExecution timeMemory
1257754tolbiSuper Dango Maker (JOI22_dango3)C++20
100 / 100
67 ms328 KiB
#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#define coutarr(x) for (auto &it : x) cout<<it<<" ";cout<<endl;
const int X = 2000;
void Solve(int N, int M) {
	vector<int> a(N * M);
	iota(a.begin(), a.end(), 1);
	while (a.size() > 0){
		vector<int> b;
		for (int i = a.size()-1; i >= 0; i--){
			swap(a[i], a[ayahya()%(i+1)]);
		}
		while (a.size() && b.size() < X){
			b.push_back(a.back());
			a.pop_back();
		}
		if (Query(b) == 0){
			for (auto it : b){
				a.push_back(it);
			}
			continue;
		}
		int cur = 0;
		while (b.size() > N){
			int x = b.back();
			b.pop_back();
			if (Query(b) == 0){
				b.push_back(x);
				swap(b.back(), b[cur++]);
			}
			else a.push_back(x);
		}
		Answer(b);
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...