#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
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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
348 KB |
Output is correct |
2 |
Correct |
14 ms |
348 KB |
Output is correct |
3 |
Correct |
14 ms |
348 KB |
Output is correct |
4 |
Correct |
14 ms |
344 KB |
Output is correct |
5 |
Correct |
14 ms |
516 KB |
Output is correct |
6 |
Correct |
14 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
437 ms |
600 KB |
Output is correct |
2 |
Correct |
431 ms |
604 KB |
Output is correct |
3 |
Correct |
528 ms |
604 KB |
Output is correct |
4 |
Correct |
506 ms |
604 KB |
Output is correct |
5 |
Correct |
451 ms |
612 KB |
Output is correct |
6 |
Correct |
446 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1904 ms |
916 KB |
Output is correct |
2 |
Correct |
1886 ms |
720 KB |
Output is correct |
3 |
Correct |
2195 ms |
828 KB |
Output is correct |
4 |
Correct |
2164 ms |
808 KB |
Output is correct |
5 |
Correct |
1975 ms |
924 KB |
Output is correct |
6 |
Correct |
2004 ms |
1028 KB |
Output is correct |