This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#include "dango3.h"
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
typedef pair<int, int> pii;
namespace {
int n, m;
const int MXN = 405, MXM = 30;
bitset<MXN * MXM> b, c;
mt19937 rnd(time(nullptr));
vector<int> GET_REVERSE(bitset<MXN * MXM> &b) {
vector<int> v;
FOR(i, 1, n * m + 1) {
if (b[i]) continue;
v.push_back(i);
}
return v;
}
vector<int> GETANS() {
vector<int> ans;
vector<int> cand = GET_REVERSE(b);
shuffle(cand.begin(), cand.end(), rnd);
for (auto &i : cand) {
c[i] = true;
if (Query(GET_REVERSE(c)) == m - 2) {
c[i] = false;
continue;
}
ans.push_back(i);
if (ans.size() == n) break;
}
for (auto &i : ans) {
b[i] = true;
c[i] = false;
}
return ans;
}
void miku() {
FOR(i, 0, m) Answer(GETANS());
}
}
void Solve(int N, int M) {
::n = N;
::m = M;
miku();
}
Compilation message (stderr)
dango3.cpp: In function 'std::vector<int> {anonymous}::GETANS()':
dango3.cpp:37:28: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
37 | if (ans.size() == n) break;
| ~~~~~~~~~~~^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |