QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#461315 | #8812. Library 3 | thangthang | 0 | 1ms | 4116kb | C++20 | 1.6kb | 2024-07-02 17:49:17 | 2024-07-02 17:49:18 |
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;
//}
Details
Tip: Click on the bar to expand more detailed information
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%