#include <bits/stdc++.h>
#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 = 8;
vector<int> remo(vector<int> vv, int h, int k) {
vector<int> va = vv;
for (int i = 0; i < k; i++) va = trya(va, va[h]);
return va;
}
void check(vector<int> &vv, int &h, int x = k) {
if (Query(remo(vv, h, x)) != 0) {
vv = remo(vv, h, x);
return;
}
int l = 1, r = x, res = 0;
while (l <= r) {
int mid = (l + r) / 2;
if (Query(remo(vv, h, mid)) != 0) {
res = mid;
l = mid + 1;
}
else r = mid - 1;
}
if (res == 0) h++;
vv = remo(vv, h, res);
}
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);
}
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
shuffle(v.begin(), v.end(), default_random_engine(seed));
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 check(vv, h, vv.size() - h);
}
res.push_back(vv);
for (int w : vv) v = trya(v, w);
}
for (auto w : res) Answer(w);
}
Compilation message
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:65:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
65 | while (vv.size() > n) {
| ~~~~~~~~~~^~~
dango3.cpp:66:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
66 | if (h < vv.size() - k + 1) {
| ~~^~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
636 KB |
Output is correct |
2 |
Correct |
23 ms |
612 KB |
Output is correct |
3 |
Correct |
15 ms |
600 KB |
Output is correct |
4 |
Correct |
23 ms |
604 KB |
Output is correct |
5 |
Correct |
14 ms |
600 KB |
Output is correct |
6 |
Correct |
14 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
472 ms |
704 KB |
Output is correct |
2 |
Correct |
553 ms |
704 KB |
Output is correct |
3 |
Correct |
491 ms |
684 KB |
Output is correct |
4 |
Correct |
535 ms |
772 KB |
Output is correct |
5 |
Correct |
519 ms |
744 KB |
Output is correct |
6 |
Correct |
549 ms |
704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2166 ms |
1088 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |