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 "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));
for(auto &i:cand) v.eb(i);
while(sz(v) && Query(v) != 0) {
v.pop_back();
}
int k = sz(v) - sz(res);
swap(cand[k], cand.back());
k = 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 |
---|
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... |