Submission #905098

# Submission time Handle Problem Language Result Execution time Memory
905098 2024-01-12T14:58:19 Z MinaRagy06 Super Dango Maker (JOI22_dango3) C++17
7 / 100
1562 ms 1092 KB
#include <bits/stdc++.h>
#include "dango3.h"
#ifdef MINA
#include "grader.cpp"
#endif
using namespace std;
#define ll long long

void Solve(int n, int m) {
	vector<int> idx[n];
	set<int> s;
	for (int i = 1; i <= n * m; i++) {
		s.insert(i);
	}
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < m; i++) {
			int l = 1, r = s.size();
			while (l <= r) {
				int md = ((l + r) >> 1);
				int cnt = md;
				vector<int> x;
				for (int k = 0; k < j; k++) {
					x.push_back(idx[k].back());
				}
				for (auto k : s) {
					x.push_back(k);
					cnt--;
					if (cnt == 0) break;
				}
// 				cout << "Ask ";
// 				for (auto k : x) {
// 					cout << k << ' ';
// 				}
				int v = Query(x);
// 				cout << ": " << v << '\n';
				if (v >= 1) {
					r = md - 1;
				} else {
					l = md + 1;
				}
			}
			int cnt = l, pos = -1;
			for (auto k : s) {
				cnt--;
				pos = k;
				if (cnt == 0) break;
			}
// 			cout << pos << '\n';
			s.erase(pos);
			idx[j].push_back(pos);
		}
// 		for (auto i : idx[j]) {
// 			cout << i << ' ';
// 		}
// 		cout << '\n';
	}
	for (int i = 0; i < m; i++) {
		vector<int> ans;
		for (int j = 0; j < n; j++) {
			ans.push_back(idx[j].back());
			idx[j].pop_back();
		}
		Answer(ans);
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 344 KB Output is correct
2 Correct 20 ms 348 KB Output is correct
3 Correct 30 ms 348 KB Output is correct
4 Correct 28 ms 348 KB Output is correct
5 Correct 19 ms 344 KB Output is correct
6 Correct 21 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 499 ms 788 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1562 ms 1092 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -