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 {
int qry(const deque<int> &a) {
vector<int> tmp(all(a));
return Query(tmp);
}
deque<int> cand;
vector<int> amyamya(int N, int m) {
vector<int> res;
res.eb(cand.back());
cand.pop_back();
while(sz(res) < N) {
int t = cand.back();
cand.pop_back();
if(qry(cand) == m - 2) {
cand.emplace_front(t);
} else {
res.eb(t);
}
}
return res;
}
mt19937_64 rng(48763ll);
} // namespace
void Solve(int32_t N, int32_t M) {
// assert(max(N, M) <= 4);
For(i, 1, N * M) {
cand.eb(i);
}
Forr(i, M, 2) {
shuffle(all(cand), rng);
Answer(amyamya(N, i));
}
vector<int> res(all(cand));
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... |