UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#213001#3844. Bshiruiheng0124ms2452kbC++11606b2024-10-27 12:59:052024-10-27 13:04:12

answer

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using LL = __int128
#define pi pair<ll, ll>
#define fi first
#define se second
#define N 111111
ll t, n, a[N], x, y, d[N];
int main(){
	scanf("%lld", &t);
	while(t--){
		scanf("%lld", &n);
		for(int i = 1 ; i <= n ; i++)
			scanf("%lld", &a[i]);
		memset(d, 0, sizeof d);
		ll ans = (n == 2) * a[1];
		for(int i = 1 ; i < n ; i++){
			scanf("%lld%lld", &x, &y);
			ans = max(ans, a[max(x, y)]);
		}
		printf("%lld\n", ans);
	}
	return 0;
}
/*
	freopen(".in", "r", stdin);
	freopen(".out", "w", stdout);

*/

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 6ms
memory: 2060kb

input:

100
10
103717049 747895296 827450707 194881991 56246174 316941251 862709303 201105248 897349432 7985...

output:

897349432
714901553
911910763
776333316
994208406
969042215
835205461
870834433
762986103
887052534
...

result:

wrong answer 1st lines differ - expected: '194881991', found: '897349432'

Test #2:

score: 0
Wrong Answer
time: 3ms
memory: 2064kb

input:

100
9
437413060 220941142 307419141 165980578 366017110 467317665 994255993 773949952 248687675
1 2
...

output:

994255993
966457772
990790154
971199958
972733101
958642849
985616808
993463357
902890727
974889156
...

result:

wrong answer 1st lines differ - expected: '307419141', found: '994255993'

Test #3:

score: 0
Wrong Answer
time: 3ms
memory: 2060kb

input:

100
74
735587102 208983225 244593148 17016789 332931999 947146306 707706314 804221526 263031711 7922...

output:

987690488
982710570
996462480
969593392
771024356
994055026
997858673
988646928
877051730
991931645
...

result:

wrong answer 1st lines differ - expected: '735587102', found: '987690488'

Test #4:

score: 0
Wrong Answer
time: 21ms
memory: 2432kb

input:

114
37
0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 0 1
1 2
2 3
2 4
1 5
4 6...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '0', found: '1'

Test #5:

score: 0
Wrong Answer
time: 13ms
memory: 2304kb

input:

114
97
0 1 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 0 1 1 0 1 1 0 1 1 0 0 1 0 0 1 0 1 0...

output:

1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
...

result:

wrong answer 1st lines differ - expected: '0', found: '1'

Test #6:

score: 0
Wrong Answer
time: 13ms
memory: 2268kb

input:

114
88
781943290 86488882 88780042 274439482 229751860 714115187 27893563 394958056 351245885 880381...

output:

995392193
940953139
965831689
973498921
919667983
995078196
935671722
57421263
997947769
544823766
9...

result:

wrong answer 1st lines differ - expected: '781943290', found: '995392193'

Test #7:

score: 0
Wrong Answer
time: 7ms
memory: 2116kb

input:

114
6
69118224 584310431 962956728 324710518 72943796 689535865
1 2
2 3
3 4
4 5
5 6
61
799714124 424...

output:

962956728
998754953
977366255
998047341
0
964863459
980137446
998355094
759816095
999888218
95217109...

result:

wrong answer 2nd lines differ - expected: '30421275', found: '998754953'

Test #8:

score: 0
Wrong Answer
time: 12ms
memory: 2284kb

input:

114
99
904301180 723670161 175578826 302899329 876263107 634901097 423846096 721373971 806404241 133...

output:

975159126
969062520
975329282
992135311
528765574
969170004
810973901
993866723
983360145
968208250
...

result:

wrong answer 1st lines differ - expected: '390753698', found: '975159126'

Test #9:

score: 0
Wrong Answer
time: 24ms
memory: 2452kb

input:

114
89
601946180 609615757 522264444 586864465 274293132 547004323 60456078 441379556 424576145 3821...

output:

998165415
958474536
976378090
997458941
880009598
995108253
984281897
851060243
929093952
964412317
...

result:

wrong answer 1st lines differ - expected: '547004323', found: '998165415'

Test #10:

score: 0
Wrong Answer
time: 22ms
memory: 2308kb

input:

114
65
244262631 583206342 624605243 567485985 747203802 287784693 265222799 799162659 162367770 127...

output:

989249992
985241591
986332251
982762605
888159875
425358386
981428171
999305825
971841754
981261741
...

result:

wrong answer 1st lines differ - expected: '567485985', found: '989249992'