ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213849 | #582. t1 | stawalr | 0 | 280ms | 12200kb | C++11 | 800b | 2024-11-13 21:56:33 | 2024-11-13 23:09:38 |
answer
#include<bits/stdc++.h>
using namespace std;
const int mn=1e5+5;
int n;
int v[mn],r[mn];
vector<int> g[mn];
bool cmp(int x,int y)
{
return r[x]<r[y];
}
void init(int x,int y)
{
r[x]=v[x];
for(auto i:g[x])
{
if(i==y)continue;
init(i,x);
r[x]=min(r[x],r[i]);
}
sort(g[x].begin(),g[x].end(),cmp);
// cerr<<x<<" "<<y<<'\n';
}
void dfs(int x,int y)
{
for(auto i:g[x])
{
if(i==y)continue;
dfs(i,x);
}
printf("%d ",x);
}
int main()
{
int x;
scanf("%d",&n);
for(int i=2;i<=n;i++)
{
scanf("%d",&x);
g[x].push_back(i);
g[i].push_back(x);
}
for(int i=1;i<=n;i++)
{
scanf("%d",&v[i]);
}
init(1,0);
dfs(1,0);
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
input:
100 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 ...
output:
52 61 64 100 53 73 97 50 49 48 47 63 46 45 44 51 43 78 42 41 40 62 39 38 71 93 37 36 35 83 34 33 88 ...
result:
wrong answer 2nd numbers differ - expected: '75', found: '61'
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 3596kb
input:
100 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 ...
output:
97 98 56 64 50 49 81 69 48 74 47 46 77 45 83 44 73 43 88 71 42 66 100 63 51 41 62 40 39 38 92 37 36 ...
result:
wrong answer 5th numbers differ - expected: '88', found: '50'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 3588kb
input:
100 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 ...
output:
68 71 60 96 50 49 87 62 48 47 46 45 44 43 42 41 40 39 86 38 37 78 36 79 35 92 67 56 34 52 33 32 31 5...
result:
wrong answer 2nd numbers differ - expected: '100', found: '71'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
1000 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...
output:
720 764 559 958 922 685 918 793 760 840 659 637 718 535 722 508 646 576 657 597 582 987 734 986 723 ...
result:
wrong answer 2nd numbers differ - expected: '630', found: '764'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
1000 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...
output:
993 967 945 661 836 916 659 525 592 528 500 499 622 892 498 843 497 496 797 495 518 494 918 904 646 ...
result:
wrong answer 5th numbers differ - expected: '760', found: '836'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
input:
1000 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...
output:
865 613 677 573 774 880 521 500 499 498 497 496 495 494 493 554 492 491 565 720 561 490 942 630 489 ...
result:
wrong answer 2nd numbers differ - expected: '829', found: '613'
Test #7:
score: 0
Wrong Answer
time: 85ms
memory: 12200kb
input:
100000 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 ...
output:
60966 89039 64552 93630 54023 78126 63619 94450 67182 72130 79445 50000 87360 49999 49998 49997 4999...
result:
wrong answer 2nd numbers differ - expected: '84526', found: '89039'
Test #8:
score: 0
Wrong Answer
time: 41ms
memory: 12200kb
input:
100000 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 ...
output:
73271 97790 79288 53984 60747 97468 53394 52028 86145 66044 83125 79189 71343 78642 64397 71791 5494...
result:
wrong answer 6th numbers differ - expected: '85301', found: '97468'
Test #9:
score: 0
Wrong Answer
time: 66ms
memory: 12192kb
input:
100000 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 ...
output:
96945 83722 81955 71333 78638 95923 70797 76976 94895 52218 95509 93397 66024 90339 80771 61576 6878...
result:
wrong answer 2nd numbers differ - expected: '71333', found: '83722'
Test #10:
score: 0
Wrong Answer
time: 86ms
memory: 12192kb
input:
100000 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 ...
output:
86618 75549 81311 81012 97035 72207 92094 68436 74897 70334 75944 68358 79221 66365 59063 84678 5914...
result:
wrong answer 3rd numbers differ - expected: '54929', found: '81311'