QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123511#91. Secret Permutationbashkort#0 1ms3952kbC++201.0kb2023-07-12 19:07:062024-07-04 00:37:24

Judging History

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

  • [2024-07-04 00:37:24]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3952kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-12 19:07:06]
  • 提交

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);
}

Details

Tip: Click on the bar to expand more detailed information

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%