#81

by asd

Submitted 4 years 9 months 1 day ago
Thu Feb 13 19:16:46 CST 2020
Judger: ZJS
Dataset Version: v0

171 ms / 8364 KB
Final 100
Problem: lss3.tour
Language: GNU C++ 11


#1

0ms / 6916KB / Accepted
Input
1000
839 271 321170583
483 834 851835113
904 569 989758461
679 467 738685794
97 572 502811503
922 678 887166139
389 404 89733323
877 593 104917199
99 648 478583910
549 510 779739573
704 449 898325859
533 514 953092146
753 346 615612744
97 848<...>
Output
1026468165586
Answer
1026468165586
Checker Information
"1026468165586"

#2

15ms / 6912KB / Accepted
Input
1000
423 52 238348849
733 889 841617912
762 229 828884522
995 649 981562365
446 822 155338839
415 922 742767475
156 490 715734327
58 959 587873219
351 933 788393232
308 250 459093391
19 406 171783974
295 38 535209223
136 925 769146922
179 562<...>
Output
978702004554
Answer
978702004554
Checker Information
"978702004554"

#3

15ms / 6920KB / Accepted
Input
1000
21 975 409381288
705 11 213855635
481 536 147891442
89 423 313785137
976 35 56948298
926 112 689127674
928 398 235914540
121 896 835834420
542 499 330491398
718 671 150252952
446 846 119495178
435 114 364548424
741 12 448143429
222 486 8<...>
Output
966133750633
Answer
966133750633
Checker Information
"966133750633"

#4

15ms / 6920KB / Accepted
Input
1000
431 646 593455869
801 661 830337441
220 827 308013330
793 766 113950492
276 699 623907250
981 170 815674179
923 918 156859533
78 596 114188647
160 237 269247823
723 807 733843400
112 937 758924237
563 830 403889887
695 951 489799034
204 <...>
Output
976778016816
Answer
976778016816
Checker Information
"976778016816"

#5

15ms / 6916KB / Accepted
Input
1000
264 967 571070694
379 225 607498953
989 418 126908346
546 809 451745070
97 615 751017325
971 423 325754134
202 291 142812773
145 589 372691192
938 493 840849956
585 21 197015842
285 411 928723350
713 476 112503862
239 9 397885609
424 226<...>
Output
977046375418
Answer
977046375418
Checker Information
"977046375418"

#6

31ms / 6916KB / Accepted
Input
1000
235 871 978934874
30 258 429758034
168 470 219448222
550 269 208285221
933 382 313798948
814 462 103855670
355 88 996365134
384 389 586395960
1000 476 321847123
452 97 426900645
641 83 271888246
720 219 559653398
788 596 430278779
323 54<...>
Output
949996691527
Answer
949996691527
Checker Information
"949996691527"

#7

30ms / 6916KB / Accepted
Input
1000
736 2 139244131
880 232 276666657
40 577 642245161
505 744 1340636
888 115 75281778
420 290 532735934
786 772 396787723
209 53 195492831
115 953 331579312
799 624 866130887
414 435 214187493
663 667 564640360
119 721 580720901
666 347 39<...>
Output
960031562519
Answer
960031562519
Checker Information
"960031562519"

#8

15ms / 6916KB / Accepted
Input
1000
75 479 101593895
714 904 565368925
248 748 911251304
240 209 241123268
701 410 329684092
598 953 900427349
271 16 674967356
154 379 431828067
730 734 673601002
314 855 232181273
581 746 245254499
51 350 304271313
51 439 781146000
717 688<...>
Output
958540464257
Answer
958540464257
Checker Information
"958540464257"

#9

15ms / 6916KB / Accepted
Input
1000
949 852 635440976
67 470 98982940
186 427 313751582
241 997 175854190
31 937 87717931
308 933 365535732
22 445 672851094
369 661 654368202
103 527 217826548
909 388 939329349
448 846 1652649
341 575 433715307
705 393 296237433
135 455 10<...>
Output
965152719820
Answer
965152719820
Checker Information
"965152719820"

#10

0ms / 6916KB / Accepted
Input
1000
950 236 499342793
90 881 740805544
685 749 650213414
634 75 366405757
908 605 885932762
374 119 939735371
676 142 446029483
235 48 34599504
800 447 460787851
374 97 846955831
458 276 925183721
356 913 371324550
494 379 664913475
189 559 <...>
Output
936992032516
Answer
936992032516
Checker Information
"936992032516"

#11

15ms / 6916KB / Accepted
Input
1000
753 641 199315214
314 925 658552850
625 765 165117597
171 606 925864590
203 235 805280578
866 463 907188807
966 55 387672597
569 316 435671763
828 85 908107375
220 616 616886422
87 411 956200019
483 819 744506964
628 834 627980331
25 384<...>
Output
954715090859
Answer
954715090859
Checker Information
"954715090859"

#12

15ms / 6916KB / Accepted
Input
1000
843 833 991570846
544 433 251180611
262 938 789497412
448 707 21502453
673 161 161054771
533 172 194623129
369 395 944788548
784 358 304874446
298 631 762953884
128 280 630008001
700 481 254971899
129 122 496159642
731 726 139272785
782 <...>
Output
978360516568
Answer
978360516568
Checker Information
"978360516568"

#13

15ms / 6916KB / Accepted
Input
1000
223 152 672318111
973 524 773553559
808 365 102830807
446 83 702680063
181 267 668097829
414 692 381048384
153 70 425096444
221 458 290902015
981 530 730058205
257 94 414408011
895 283 930957654
509 841 876395945
856 807 553378346
711 41<...>
Output
939538004735
Answer
939538004735
Checker Information
"939538004735"

#14

15ms / 6916KB / Accepted
Input
1000
44 600 425832403
311 679 95324996
936 978 926360156
181 114 740914181
152 179 155615620
144 351 724380477
234 695 480686394
244 749 466909228
195 202 946349318
950 990 407864424
584 878 528105055
550 332 271163993
496 345 290285625
987 4<...>
Output
957471814674
Answer
957471814674
Checker Information
"957471814674"

#15

15ms / 6916KB / Accepted
Input
1000
189 540 854007536
937 499 22795847
319 576 139574348
184 707 718618624
622 56 262819503
111 475 516695637
148 911 291557763
722 384 924505816
375 617 92631882
645 216 118465996
271 382 681759258
65 476 353489843
53 219 106548552
652 698 <...>
Output
939420835751
Answer
939420835751
Checker Information
"939420835751"

#16

15ms / 6916KB / Accepted
Input
1000
380 612 213704206
681 408 51580222
241 917 75874620
202 982 592508748
721 833 208383283
450 744 807437376
458 627 48571404
728 353 108224449
716 186 925659637
800 362 973929550
321 626 818260364
886 545 972415414
759 546 556871537
760 45<...>
Output
943428038073
Answer
943428038073
Checker Information
"943428038073"

#17

15ms / 6916KB / Accepted
Input
1000
65 554 54685061
91 85 583231043
144 664 707123757
400 173 206035807
839 902 256004908
910 690 345124654
306 584 672112567
161 738 267067578
923 676 860058454
680 746 152440756
681 380 735616471
749 323 305434503
484 846 933014150
549 734<...>
Output
962284799656
Answer
962284799656
Checker Information
"962284799656"

#18

0ms / 6916KB / Accepted
Input
1000
377 17 346176652
260 624 723128848
841 613 945765310
669 569 762896103
739 65 409984045
925 259 392727288
786 300 501651323
265 89 428742636
325 39 20315413
901 996 281361781
68 264 727252865
805 847 171515077
180 261 487982329
9 223 803<...>
Output
937172945977
Answer
937172945977
Checker Information
"937172945977"

#19

15ms / 6916KB / Accepted
Input
1000
14 697 793713687
314 878 478874071
31 798 590994702
923 650 215907634
149 659 318707556
384 707 500687705
428 319 851202651
611 725 357921354
241 1 426189811
802 868 37478223
488 482 32306521
638 247 455021719
196 163 536980636
462 10 39<...>
Output
933115979085
Answer
933115979085
Checker Information
"933115979085"

#20

31ms / 6920KB / Accepted
Input
1000
988 875 502448331
777 377 658269317
413 560 268921541
975 232 684091499
673 612 60585841
826 762 429088165
699 960 435095818
571 340 3810958
288 131 791977974
403 472 598649386
466 587 577267021
601 730 286582853
32 923 747140507
644 314<...>
Output
963553849162
Answer
963553849162
Checker Information
"963553849162"

#1

124ms / 8364KB / Accepted
Input
100000
79972 51083 573825495
95761 41280 43151697
39000 5312 678983820
88580 29627 298514470
14424 92846 921967938
47131 73528 71707346
68421 71502 433124805
25714 62175 88846958
44499 41653 187794089
42842 79422 288256893
39744 79911 48863833
<...>
Output
100100110565638
Answer
100100110565638
Checker Information
"100100110565638"

#2

124ms / 8352KB / Accepted
Input
100000
56595 45181 672582656
29809 56012 369235204
79257 49137 821032157
34255 42717 569356249
35866 80060 72652734
17470 32306 848721557
87532 76147 954091522
65240 79637 565420137
38160 45295 220315256
91510 13878 260797139
41107 51483 9733880<...>
Output
99859757188927
Answer
99859757188927
Checker Information
"99859757188927"

#3

124ms / 8348KB / Accepted
Input
100000
34047 7197 299830589
48398 38535 922868235
4482 38319 282979616
86383 73892 513606380
45684 83128 500433593
40532 20167 638301271
1869 84782 43482896
12524 93571 560227055
41 87894 341404636
91322 21989 92627488
43733 79291 977692233
496<...>
Output
99771091956587
Answer
99771091956587
Checker Information
"99771091956587"

#4

109ms / 8348KB / Accepted
Input
100000
12360 35015 198083377
98008 75948 787558295
27843 17942 90631391
12851 35013 211699666
90234 90171 282833122
69659 42104 825800445
29428 14732 380790213
10164 47126 178053084
94156 10429 49079341
20176 35268 780857674
7070 67845 379639905<...>
Output
99864439726883
Answer
99864439726883
Checker Information
"99864439726883"

#5

140ms / 8340KB / Accepted
Input
100000
77436 20710 13822535
5615 60752 766781112
45578 86150 50867112
34550 50384 28978115
80042 49835 464557860
77406 794 876745027
5017 14124 921338083
3900 88039 352399989
94619 50716 104502651
81609 24348 732074484
40254 52578 219339483
411<...>
Output
99912717057371
Answer
99912717057371
Checker Information
"99912717057371"

#6

93ms / 8344KB / Accepted
Input
100000
72591 45183 111445213
28100 99334 362765306
48858 97980 796527842
63380 16167 22685173
84607 74198 751338405
37911 60983 410782416
58251 19789 342519630
65147 87142 935128976
92789 70356 713394495
98820 11479 878621753
20837 90165 3603733<...>
Output
99869717883745
Answer
99869717883745
Checker Information
"99869717883745"

#7

124ms / 8344KB / Accepted
Input
100000
67711 61463 633361764
40081 7670 798524285
91863 65463 63380773
41714 77283 28390746
7081 71207 412976523
78479 23324 581960302
61481 42265 103335973
82560 74977 871277372
19495 40700 306896395
13856 780 963679867
962 96697 302314565
196<...>
Output
100110407459575
Answer
100110407459575
Checker Information
"100110407459575"

#8

171ms / 8344KB / Accepted
Input
100000
13718 20472 963774439
46598 40717 814203852
4406 22379 492118884
80262 85431 921420918
82667 55154 343432136
69375 34462 260267782
69200 83560 553014734
76111 27487 541818600
41199 37493 675903990
34667 51614 34499356
1264 74508 138298228<...>
Output
100079578806954
Answer
100079578806954
Checker Information
"100079578806954"

#9

171ms / 8344KB / Accepted
Input
100000
5430 24717 886571603
9261 69250 478973211
97043 96722 102312403
73022 77871 771432859
17136 43094 573331114
42195 32524 545295217
33580 67110 637567107
10406 88564 180170743
13672 15975 593898594
30590 70678 751878303
75269 42405 99902232<...>
Output
99857921220230
Answer
99857921220230
Checker Information
"99857921220230"

#10

140ms / 8340KB / Accepted
Input
100000
30748 82245 162034583
11245 917 509552403
30687 88876 590539757
2467 75854 268008372
809 49708 405925310
79834 6867 421127460
6130 82501 343915232
73137 32317 415909922
97747 4168 148150611
79431 32228 157284461
39720 53613 771545475
783<...>
Output
99630676638895
Answer
99630676638895
Checker Information
"99630676638895"

#11

156ms / 8340KB / Accepted
Input
100000
32141 70216 176499197
91958 47979 716885906
26087 25596 346730353
23495 52248 994366431
28130 65269 899250269
15362 14475 192032000
89076 83141 21695312
77512 92081 219575655
25527 31323 301342560
46500 41184 481699412
6343 88989 79456129<...>
Output
99677183559975
Answer
99677183559975
Checker Information
"99677183559975"

#12

171ms / 8340KB / Accepted
Input
100000
21549 11303 668735205
19551 41185 981333326
43095 31221 76698080
19504 95148 227604620
81019 44271 602077678
17207 40690 269025343
41940 84934 454428149
5122 21239 661607178
36973 84400 826608957
59416 11079 356886729
23722 30349 89632573<...>
Output
99909086784725
Answer
99909086784725
Checker Information
"99909086784725"

#13

93ms / 8340KB / Accepted
Input
100000
56184 96527 484649543
32358 57188 88449254
84606 91152 661584201
72869 75499 895611770
87909 4194 339872267
37149 1263 657923099
5509 29012 813329816
88072 29344 201899495
30045 92395 26709650
6442 726 876388021
65246 80869 22982975
8077<...>
Output
99382611409837
Answer
99382611409837
Checker Information
"99382611409837"

#14

140ms / 8340KB / Accepted
Input
100000
39753 10453 622674613
16815 12186 315748543
30399 31517 475849714
9329 71217 271947367
29341 82493 474526850
75036 26447 343371090
18184 15085 387630075
20766 73340 974106
6703 89025 289231692
95608 87857 874487354
14714 16224 993168860
<...>
Output
99693468331604
Answer
99693468331604
Checker Information
"99693468331604"

#15

139ms / 8348KB / Accepted
Input
100000
56486 88179 472862833
46734 43918 98203841
70951 29783 107596237
53260 78993 556140663
41912 89343 425506964
35322 25859 658179436
99080 48723 604493181
84841 88669 376835897
95663 86346 40776336
27288 34880 923869064
16249 14350 52664632<...>
Output
99750676315165
Answer
99750676315165
Checker Information
"99750676315165"

#16

93ms / 8344KB / Accepted
Input
100000
29413 10417 873424103
98626 3089 199765330
41911 73974 408233823
56703 17100 277250234
20629 41688 30914071
60757 15682 727308060
49124 47912 87305184
90777 45997 906382043
61056 13962 920492674
18212 47578 154526685
10432 36392 878982111<...>
Output
99754902188295
Answer
99754902188295
Checker Information
"99754902188295"

#17

155ms / 8336KB / Accepted
Input
100000
12504 64539 223197704
44962 62658 362260428
15045 62368 242454670
71984 8372 688130073
13268 47257 351762998
11240 58683 420185560
71749 11710 38105375
50028 87790 130453347
1738 35161 993319913
88025 93603 19419378
12018 15258 637384258
<...>
Output
99634918039590
Answer
99634918039590
Checker Information
"99634918039590"

#18

140ms / 8336KB / Accepted
Input
100000
16965 48253 644281317
71233 40670 733091960
40227 44558 95015707
96186 1042 766748990
72069 63667 661809601
22711 82347 430202503
74035 28239 707703554
5941 42004 427656756
62027 89079 910535352
55431 91618 907070917
79813 51374 102021206<...>
Output
99658679557011
Answer
99658679557011
Checker Information
"99658679557011"

#19

124ms / 8348KB / Accepted
Input
100000
54514 91636 609844929
21464 76617 294581321
97436 61954 157611252
5858 52657 980942762
49650 72498 139274170
12421 15071 618437309
63251 86226 170466851
49382 16097 101087943
14508 11996 515069565
21708 36227 36840061
23975 33623 11771418<...>
Output
99921090854817
Answer
99921090854817
Checker Information
"99921090854817"

#20

124ms / 8344KB / Accepted
Input
100000
10141 16397 897807071
68860 72666 29886746
63055 3224 932780044
67641 65794 735148995
72905 57398 721482117
74255 879 311035319
8532 59844 23434915
5726 7763 849780038
12289 5540 714415294
44333 12960 105863713
54157 48171 358634940
1675<...>
Output
99771449214934
Answer
99771449214934
Checker Information
"99771449214934"
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}

int n;
vector<pii> nei[100005];

ll dis[100005];

void dfs(int pos,int par,ll dist){
	dis[pos]=dist;
	for(pii x:nei[pos]){
		if(x.first==par){
			continue;
		}
		dfs(x.first,pos,dist+x.second);
	}
}

void runDis(int s){
	memset(dis,0,sizeof(dis));
	
	dfs(s,-1,0);
}

int main(int argc,char* argv[]){
	qi;
	cin>>n;
	ll ans=0;
	for(int i=0;i<n-1;i++){
		int a,b,c;
		cin>>a>>b>>c;
		a--;b--;
		ans+=2ll*c;
		nei[a].push_back(make_pair(b,c));
		nei[b].push_back(make_pair(a,c));
	}
	
	runDis(0);
	
	ll mx=0;
	for(int i=0;i<n;i++){
		if(dis[i]>dis[mx]){
			mx=i;
		}
	}
	
	runDis(mx);
	mx=0;
	for(int i=0;i<n;i++){
		mx=max(mx,dis[i]);
	}
	
	cout<<ans-mx<<endl;
	return 0;
}