Submission #781109

# Submission time Handle Problem Language Result Execution time Memory
781109 2023-07-12T18:04:09 Z aZvezda Super Dango Maker (JOI22_dango3) C++17
22 / 100
1258 ms 2104 KB
#include "dango3.h"

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

namespace {

int variable_example = 1;

}  // namespace


void Solve(int n, int m) {
	vector<int> lft = {};
	for(int i = 1; i <= n * m; i ++) { lft.push_back(i); }
	random_shuffle(lft.begin(), lft.end());
	for(int i = 0; i < m; i ++) {
		vector<int> now = {};
		for(int j = 0; j < lft.size(); j ++) now.push_back(lft[j]);
		const auto rem = [&](const auto x) {
			for(int i = 0; i < now.size(); i ++) {
				if(now[i] == x) {
					swap(now[i], now[now.size() - 1]);
					now.pop_back();
					return;
				}
			}
		};
		int ptrbad = i * n;
		for(int j = i * n; ptrbad < (i + 1) * n; j ++) {
			int old = lft[j];
			rem(old);
			int ans = Query(now);
			cerr << "Removed " << ans << " " << old << endl;
			if(ans == m - 1) {
				swap(lft[j], lft[ptrbad]);
				ptrbad ++;
			} else {
				now.push_back(old);
			}
		}
		for(int j = 0; j < lft.size(); j ++) {
			cerr << lft[j] << " ";
		}
		cerr << endl;
	}
	for(int i = 0; i < m; i ++) {
		vector<int> group = {};
		for(int j = 0; j < n; j ++) {
			group.push_back(lft[i * n + j]);
		}
		Answer(group);
	}
}

Compilation message

dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for(int j = 0; j < lft.size(); j ++) now.push_back(lft[j]);
      |                  ~~^~~~~~~~~~~~
dango3.cpp: In instantiation of 'Solve(int, int)::<lambda(auto:23)> [with auto:23 = int]':
dango3.cpp:32:11:   required from here
dango3.cpp:21:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    for(int i = 0; i < now.size(); i ++) {
      |                   ~~^~~~~~~~~~~~
dango3.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |   for(int j = 0; j < lft.size(); j ++) {
      |                  ~~^~~~~~~~~~~~
dango3.cpp: At global scope:
dango3.cpp:8:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    8 | int variable_example = 1;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 432 KB Output is correct
2 Correct 41 ms 412 KB Output is correct
3 Correct 40 ms 340 KB Output is correct
4 Correct 39 ms 396 KB Output is correct
5 Correct 38 ms 420 KB Output is correct
6 Correct 40 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 656 ms 1408 KB Output is correct
2 Correct 565 ms 1476 KB Output is correct
3 Correct 578 ms 1504 KB Output is correct
4 Correct 610 ms 1484 KB Output is correct
5 Correct 604 ms 1464 KB Output is correct
6 Correct 587 ms 1404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1258 ms 2104 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -