QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#123511 | #91. Secret Permutation | bashkort# | 0 | 1ms | 3952kb | C++20 | 1.0kb | 2023-07-12 19:07:06 | 2024-07-04 00:37:24 |
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();
int last = qry(v, 0, b);
for (int i = 1; i <= t; ++i) {
int now = qry(v, i, b);
if (now > last || now == last && i == t) {
v.insert(v.begin() + i - 1, b);
break;
}
last = now;
}
if (size(v) != n) {
v.insert(v.begin() + t, 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);
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10.7143
Acceptable Answer
time: 1ms
memory: 3864kb
input:
7 5 7 1 3 2 4 6
output:
0 12 1050790
result:
points 0.71428571430 12 steps
Test #2:
score: 13.5
Acceptable Answer
time: 1ms
memory: 3728kb
input:
4 3 4 2 1
output:
0 5 0
result:
points 0.90 5 steps
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3952kb
input:
6 3 5 4 2 6 1
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%