ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213821 | #582. t1 | N | 0 | 261ms | 10656kb | C++11 | 963b | 2024-11-13 20:27:51 | 2024-11-13 23:06:37 |
answer
//
// na 1156.cpp
// Competitive Programming
//
// Created by m2 on 2024/11/13.
//
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#ifdef MAC_OS_VERSION_11_0
const int maxn = 15;
#else
const int maxn = 1e5 + 5;
#endif
int n, v[maxn], r[maxn], p[maxn];
vector<int> ch[maxn];
void dfs1(int idx){
r[idx] = v[idx];
for(int c: ch[idx]){
dfs1(c);
r[idx] = min(r[idx], r[c]);
}
}
inline bool cmpr(int a, int b){
return r[a] < r[b];
}
void sol(int idx){
sort(ch[idx].begin(), ch[idx].end(), cmpr);
for(int c: ch[idx])
sol(c);
cout << idx << ' ';
}
int main(){
cin.tie(0)->sync_with_stdio(false);
cin >> n;
for(int i = 2; i <= n; ++i){
cin >> p[i];
ch[p[i]].push_back(i);
}
for(int i = 1; i <= n; ++i)
cin >> v[i];
dfs1(1);
sol(1);
cout << endl;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3628kb
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: 0ms
memory: 3628kb
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: 3628kb
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: 3696kb
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: 2ms
memory: 3692kb
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: 3696kb
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: 58ms
memory: 10648kb
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: 67ms
memory: 10656kb
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: 68ms
memory: 10656kb
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: 66ms
memory: 10652kb
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'