QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#489752 | #8812. Library 3 | bambam# | 0 | 1ms | 3768kb | C++17 | 804b | 2024-07-25 00:16:57 | 2024-07-25 00:16:57 |
answer
#include "library3.h"
#include <bits/stdc++.h>
using namespace std;
int count_cycles(vector<int> p) {
return p.size() - query(p);
}
void solve(int n) {
vector<int> p(n);
iota(p.begin(), p.end(), 0);
int lst = count_cycles(p);
for (int i = 1; i < n; ++i) {
int l = 0, r = i - 1;
while (l != r) {
int m = (l + r) / 2;
auto q = p;
for (int j = 1; j <= m; ++j) swap(p[j], p[j - 1]);
swap(p[m], p[i]);
if (count_cycles(p) > lst - m) r = m;
else l = m + 1;
swap(p[m], p[i]);
for (int j = m; j >= 1; --j) swap(p[j], p[j - 1]);
assert(q == p);
}
swap(p[i], p[l]);
lst = count_cycles(p);
}
answer(p);
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3768kb
input:
2 0 1
output:
? 0 1 ? 1 0 ! 1 0 -
result:
wrong answer Wrong Answer [8]
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%