QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#511521 | #5451. 树据结构 | AdamGS | 0 | 20ms | 23536kb | C++23 | 1.4kb | 2024-08-09 23:40:29 | 2024-08-09 23:40:29 |
Judging History
answer
#include "ds.h"
#include<bits/stdc++.h>
using namespace std;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
vector<pair<int,int>>V;
vector<int>licz(int x, vector<int>P) {
cout << "! licz " << x << ": ";
for(auto i : P) cout << i << " ";
cout << '\n';
vector<pair<int,int>>T;
vector<int>X;
for(auto i : P) T.pb({query(i), i});
sort(all(T));
if(T.size()==1) {
if(T[0].st!=x) {
exchange(T[0].st, x);
V.pb({T[0].st, x});
}
return P;
}
int l=0;
for(int i=1; i<T.size(); ++i) if(T[i].st!=T[i-1].st) {
vector<int>A;
while(l<i) A.pb(T[l++].nd);
if(T[l-1].st!=x) {
exchange(T[l-1].st, x);
V.pb({T[l-1].st, x});
}
A=licz(x, A);
x+=A.size();
for(auto j : A) X.pb(j);
}
vector<int>A;
while(l<T.size()) A.pb(T[l++].nd);
if(T[l-1].st!=x) {
exchange(T[l-1].st, x);
V.pb({T[l-1].st, x});
}
A=licz(x, A);
for(auto j : A) X.pb(j);
return X;
}
void solve(int n, int lim1, int lim2) {
vector<int>T(n-1);
rep(i, n-1) T[i]=i+2;
T=licz(1, T);
vector<int>par(n-1), val(n-1);
rep(i, n-2) par[T[i+1]-2]=T[i];
par[T[0]-2]=1;
vector<int>P(n);
rep(i, n) P[i]=i;
reverse(all(V));
for(auto i : V) swap(P[i.st], P[i.nd]);
rep(i, n-1) val[T[i]-2]=P[i+1];
answer(par, val);
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 22248kb
input:
sfdjklasl2335n1j;llksaet35GTwejtklwrklakrjlt 50 1000001 1000001 2351tgsaldjkgakldfjtkjl;3136sajdflkjasdf135bbbwq 28 2 18 36 14 34 37 5 44 1 21 29 46 16 43 31 33 30 23 50 17 8 26 41 3 24 40 11 35 10 27 45 39 13 42 19 4 47 7 49 32 48 15 6 20 22 12 38 25 3 36 9 26 32 4 43 29 47 31 14 11 27 39 49 5 8 42...
output:
! licz 1: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 ! licz 1: 11 13 29 35 ! licz 1: 11 ! licz 2: 13 29 ! licz 2: 29 ! licz 3: 13 ! licz 4: 35 ! licz 5: 30 ! licz 6: 19 ! licz 7: 4 6 8 12 14 18 2...
result:
wrong answer 1st lines differ - expected: '6640196347516987400', found: '! licz 1: 2 3 4 5 6 7 8 9 10 1... 41 42 43 44 45 46 47 48 49 50 '
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 20ms
memory: 23536kb
input:
sfdjklasl2335n1j;llksaet35GTwejtklwrklakrjlt 20000 3000004 3000004 2351tgsaldjkgakldfjtkjl;3136sajdflkjasdf135bbbwq 4879 6169 1969 17706 4213 18093 4963 18252 19119 2557 12571 19437 17865 6637 7288 13247 12644 15689 13894 5948 4474 12271 18580 6962 20000 8024 17921 15238 125 4044 14282 297 2126 1468...
output:
! licz 1: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...
result:
wrong answer 1st lines differ - expected: '11411519532273973792', found: '! licz 1: 2 3 4 5 6 7 8 9 10 1... 19996 19997 19998 19999 20000 '
Subtask #5:
score: 0
Skipped
Dependency #1:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
0%
Subtask #7:
score: 0
Skipped
Dependency #1:
0%