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 <iostream>
#include <vector>
#include "dango3.h"
using namespace std;
vector<int> trya(vector<int> v, int x) {
vector<int> vv;
for (int w : v) {
if (w != x) {
vv.push_back(w);
}
}
return vv;
}
/*void Print(vector<int> v) {
for (int w : v) cout << w << " ";
cout << '\n';
}
int Query(vector<int> v) {
Print(v);
int k;
cin >> k;
return k;
}
void Answer(vector<int> v) {
Print(v);
}
void Solve(int n, int m);
int main() {
int n = 4, m = 4;
Solve(n, m);
}*/
int k = 10;
void check(vector<int> &vv, int &h) {
vector<int> va = vv;
for (int i = 0; i < k; i++) va = trya(va, va[h]);
if (Query(va) != 0) {
vv = va;
return;
}
for (int i = h; i < h + k; i++) {
if (Query(trya(vv, vv[i]))) {
vv = trya(vv, vv[i]);
h = i;
return;
}
}
h += k;
}
void Solve(int n, int m) {
vector<int> v;
vector<vector<int>> res;
for (int i = 1; i <= n * m; i++) {
v.push_back(i);
}
for (int i = 1; i <= m; i++) {
vector<int> vv = v;
int h = 0;
while (vv.size() > n) {
if (h < vv.size() - k + 1) {
check(vv, h);
}
else if (Query(trya(vv, vv[h])) != 0) {
vv = trya(vv, vv[h]);
}
else h++;
}
res.push_back(vv);
for (int w : vv) v = trya(v, w);
}
for (auto w : res) Answer(w);
}
Compilation message (stderr)
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:58:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
58 | while (vv.size() > n) {
| ~~~~~~~~~~^~~
dango3.cpp:59:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
59 | if (h < vv.size() - k + 1) {
| ~~^~~~~~~~~~~~~~~~~~~
# | 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... |