#include "dango3.h"
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;
namespace {
vector<int> cand;
vector<int> res;
int amyamya() {
vector<int> v(all(res));
int hi = sz(cand), lo = 0;
while(hi - lo > 1) {
int mi = (hi + lo) / 2;
For(i, 0, mi - 1) v.eb(cand[i]);
if(Query(v) == 0) lo = mi;
else hi = mi;
v.erase(v.begin() + sz(res), v.end());
}
int k = cand[lo];
swap(cand[lo], cand.back());
cand.pop_back();
return k;
}
} // namespace
void Solve(int32_t N, int32_t M) {
// assert(max(N, M) <= 4);
For(i, 1, N * M) {
cand.eb(i);
}
For(i, 1, M) {
res.clear();
For(j, 1, N) res.eb(amyamya());
// For(j, 0, N - 1) cout << res[j] << " \n"[j == N - 1];
Answer(res);
}
}
/*
g++ -std=c++14 -O2 -o grader grader.cpp dango3.cpp & grader.exe < input.txt > output.txt 2> error.txt
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
276 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
340 KB |
Output is correct |
2 |
Correct |
14 ms |
412 KB |
Output is correct |
3 |
Correct |
22 ms |
340 KB |
Output is correct |
4 |
Correct |
24 ms |
308 KB |
Output is correct |
5 |
Correct |
11 ms |
340 KB |
Output is correct |
6 |
Correct |
11 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
195 ms |
468 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
475 ms |
536 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |