QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#489751#8812. Library 3bambam#0 1ms3764kbC++17750b2024-07-25 00:15:322024-07-25 00:15:32

Judging History

你现在查看的是最新测评结果

  • [2024-07-25 00:15:32]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3764kb
  • [2024-07-25 00:15:32]
  • 提交

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;
            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]);
        }
        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: 3764kb

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%