Submission #905940

# Submission time Handle Problem Language Result Execution time Memory
905940 2024-01-13T07:31:46 Z daoquanglinh2007 Super Dango Maker (JOI22_dango3) C++17
0 / 100
1218 ms 916 KB
#include "dango3.h"

#include <bits/stdc++.h>

using namespace std;

int N, M;

int Ask(vector <int> &v){
	vector <int> sv(0);
	int j = 1;
	for (int i : v){
		while (j < i) sv.push_back(j++);
		j++;
	}
	while (j <= N*M) sv.push_back(j++);
	return M-Query(sv);
}

void Solve(int a, int b) {
	N = a, M = b;
	vector <int> g[M+1], v;
	for (int i = 1; i <= M; i++) g[i].clear();
	for (int i = 1; i <= N*M; i++){
		int l = 1, r = M, res = -1;
		while (l <= r){
			int mid = (l+r)/2;
			v.clear();
			for (int j = 1; j <= mid; j++)
				for (int x : g[j]) v.push_back(x);
			v.push_back(i);
			
			if (Ask(v) <= mid){
				res = mid;
				r = mid-1;
			}
			else l = mid+1;
		}
		g[res].push_back(i);
	}
	for (int i = 1; i <= M; i++) Answer(g[i]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Wrong Answer [7]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 344 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 312 ms 588 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1218 ms 916 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -