QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#123508#91. Secret Permutationbashkort#0 0ms4056kbC++20978b2023-07-12 18:53:012024-07-04 00:37:20

Judging History

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

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

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 lo = 0, hi = t;
        while (lo < hi) {
            int mid = lo + hi >> 1;
            if (qry(v, mid, b) > qry(v, mid + 1, b)) {
                lo = mid + 1;
            } else {
                hi = mid;
            }
        }
        v.insert(v.begin() + lo, 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: 6.94286
Acceptable Answer
time: 0ms
memory: 4056kb

input:

7
5 7 1 3 2 4 6

output:

0 26 1050790

result:

points 0.46285714290 26 steps

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3996kb

input:

4
3 4 2 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%