#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;
void amyamya(int n, int m, int s) {
int last = m;
vector<int> res;
vector<int> v(all(cand));
while(last != 0) {
v.pop_back();
int cur = Query(v);
if(cur < last) res.eb(sz(v));
last = cur;
}
For(i, 0, m - 1) swap(cand[s + i], cand[res[i]]);
}
} // namespace
void Solve(int32_t N, int32_t M) {
// assert(max(N, M) <= 4);
For(i, 1, N * M) {
cand.eb(i);
}
For(i, 0, N - 2) {
amyamya(N, M, N * i);
}
For(i, 0, M - 1) {
vector<int> res;
for(int j = i; j < N * M; j += M) res.eb(cand[j]);
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 |
Incorrect |
1 ms |
340 KB |
Wrong Answer [7] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
356 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
694 ms |
408 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1425 ms |
472 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |