QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#123509 | #91. Secret Permutation | bashkort# | 0 | 0ms | 4004kb | C++20 | 871b | 2023-07-12 18:54:40 | 2024-07-04 00:37:23 |
Judging History
answer
#pragma once
#include "permutation.h"
#include <bits/stdc++.h>
namespace {
using namespace std;
mt19937 rnd(228);
}
void solve(int n) {
vector<int> p(n);
iota(p.begin(), p.end(), 1);
auto qry = [&](vector<int> v, int pos, int i) {
v.insert(v.begin() + pos, i);
return query(v);
};
for (int t = 2; t < n; ++t) {
vector<int> v = p;
v.pop_back();
int b = p.back();
pair<int, int> best{1e9, 0};
for (int i = 0; i <= t; ++i) {
best = min(best, {qry(v, i, b), i});
}
v.insert(v.begin() + best.second, b);
p = v;
}
vector<int> ans(n);
for (int i = 0; i < n; ++i) {
ans[p[i] - 1] = i + 1;
}
for (int x : ans) {
cerr << x << " ";
}
cerr << endl;
answer(ans);
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 4004kb
input:
7 5 7 1 3 2 4 6
output:
-1
result:
wrong answer Your answer is not correct.
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%