QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#461315#8812. Library 3thangthang0 1ms4116kbC++201.6kb2024-07-02 17:49:172024-07-02 17:49:18

Judging History

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

  • [2024-07-02 17:49:18]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:4116kb
  • [2024-07-02 17:49:17]
  • 提交

answer

#include <bits/stdc++.h>
#include "library3.h"

using namespace std;

//const int maxN = 505;
//
//int n, p[maxN];
//
//void answer(vector <int> &ans){
//    for (auto p : ans) cout << p << ' ';
//    cout << endl;
//    for (int i = 0; i < n; ++ i) if (p[i] != ans[i]){
//        cout << "Wrong ans" << '\n';
//        return;
//    }
//    cout << "Correct" << '\n';
//}
//
//int query(vector <int> &ask){
//    vector <int> nxt(n, 0);
//    for (int i = 0; i < n; ++ i) nxt[ask[i]] = p[i];
//    vector <bool> vis(n, false);
//    int num = 0;
//    for (int i = 0; i < n; ++ i){
//        if (!vis[i]){
//            ++ num;
//            int u = i;
//            while (!vis[u]){
//                vis[u] = true;
//                u = nxt[u];
//            }
//        }
//    }
//
//    return n - num;
//}

void solve(int N){
    vector <int> ans;
    for (int i = 0; i < N; ++ i) ans.push_back(i);

    int last = query(ans);
    for (int i = 1; i < N; ++ i){
        int cur = i;
        int l = 0;
        int r = i - 1;
        while (l <= r){
            int mid = l + r >> 1;
            vector <int> ask = ans;
            ask[0] = ans[i];
            for (int i = 1; i <= mid; ++ i) ask[i] = ans[i - 1];
            ask[i] = ans[0];
            if (query(ask) < last + mid){
                cur = mid;
                r = mid - 1;
            }
            else l = mid + 1;
        }
        swap(ans[i], ans[cur]);
        last = query(ans);
    }

    answer(ans);
}

//int main(){
//    cin >> n;
//    for (int i = 0; i < n; ++ i) cin >> p[i];
//
//    solve(n);
//
//    return 0;
//}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 2
Accepted
time: 1ms
memory: 3848kb

input:

2
0
1
0

output:

? 0 1
? 1 0
? 0 1
! 0 1
-

result:

ok Accepted

Test #2:

score: -2
Wrong Answer
time: 0ms
memory: 4116kb

input:

3
2
1
1
2

output:

? 0 1 2
? 1 0 2
? 1 0 2
? 2 0 1
? 2 1 1

result:

wrong answer Wrong Answer [3]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%