QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#56338 | #2380. Graph and Cycles | tricyzhkx | AC ✓ | 185ms | 8308kb | C++14 | 420b | 2022-10-18 19:58:38 | 2022-10-18 19:58:39 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> a[1010];
int main()
{
int n,u,v,w;
ll ans=0;
cin>>n;
for(int i=1;i<=n*(n-1)/2;i++)
{
scanf("%d%d%d",&u,&v,&w);ans+=2*w;
a[u].push_back(w);a[v].push_back(w);
}
for(int i=1;i<=n;i++)
{
sort(a[i].begin(),a[i].end());
for(int j=0;j<n-1;j+=2) ans+=abs(a[i][j]-a[i][j+1]);
}
cout<<ans/2<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3768kb
input:
3 1 2 1 2 3 1 3 1 1
output:
3
result:
ok single line: '3'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
5 4 5 4 1 3 4 1 2 4 3 2 3 3 5 2 1 4 3 4 2 2 1 5 4 5 2 4 3 4 2
output:
35
result:
ok single line: '35'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
21 11 3 625044859 10 19 823805063 15 7 777050814 21 17 238356072 1 5 50243331 5 17 190660970 11 2 976866345 8 21 482998523 19 13 808025492 2 13 519935350 7 16 326709240 10 6 689598272 8 7 876476518 11 19 567566846 12 8 973819832 14 12 208492286 17 6 2122420 16 4 627490340 19 17 124573521 11 18 26966...
output:
107253690394
result:
ok single line: '107253690394'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3804kb
input:
101 58 55 791211884 51 43 54360060 84 37 727397880 40 97 521271341 25 66 266334887 92 53 280617531 30 24 500154366 59 35 971451068 99 89 488736631 8 15 860682353 7 80 195210553 30 9 607214259 64 40 290067860 68 6 690832578 75 43 35206820 86 8 278282740 1 55 898997886 92 50 102946527 36 72 635388311 ...
output:
2524874662788
result:
ok single line: '2524874662788'
Test #5:
score: 0
Accepted
time: 52ms
memory: 4940kb
input:
499 411 11 363792269 99 496 916354088 13 10 424586659 473 424 930817156 460 132 294016190 348 466 774501486 112 386 489080996 343 397 529302215 335 192 437511371 199 79 381123563 85 210 323274162 453 135 466041199 212 394 415599780 221 179 120706561 327 235 257319143 89 119 372123673 276 407 4016459...
output:
62243194202798
result:
ok single line: '62243194202798'
Test #6:
score: 0
Accepted
time: 159ms
memory: 7828kb
input:
999 552 472 607221214 796 528 301181674 640 51 51216620 713 778 903672485 933 423 117198463 112 273 731932093 724 948 981999908 820 905 644660120 673 92 717585013 867 123 813289921 480 292 661329792 392 513 973996822 553 916 73623440 117 576 843850646 611 713 441348352 695 468 443014848 858 357 3861...
output:
249251247296734
result:
ok single line: '249251247296734'
Test #7:
score: 0
Accepted
time: 171ms
memory: 7972kb
input:
999 475 874 209924142 686 149 19287456 639 356 772284282 319 124 680771912 737 849 304374538 230 815 116457997 575 237 158757728 425 250 348756010 142 725 845139073 640 627 583907581 878 589 794169257 315 376 576590031 587 109 123010135 347 209 158097195 967 329 549802099 352 277 706496938 283 731 9...
output:
249276562402311
result:
ok single line: '249276562402311'
Test #8:
score: 0
Accepted
time: 147ms
memory: 8208kb
input:
999 833 963 590423415 165 571 280341733 734 240 283869926 133 436 334469041 664 24 670070868 583 180 17215081 600 929 491122524 732 414 735212550 777 488 793545744 403 520 380344303 959 244 45807176 269 506 522232083 621 915 447876838 878 865 338876669 456 313 680044893 981 280 3044767 851 41 259170...
output:
249508939394179
result:
ok single line: '249508939394179'
Test #9:
score: 0
Accepted
time: 163ms
memory: 7796kb
input:
999 233 230 761107191 95 689 449133945 329 275 169281798 428 945 857511817 864 220 37184405 839 772 271965038 135 823 815965063 807 414 912736628 358 729 992089182 261 89 788462854 637 188 785335702 508 339 625690388 470 18 491573828 720 37 467965268 67 946 18744626 870 647 508717386 673 364 9907353...
output:
249565245319699
result:
ok single line: '249565245319699'
Test #10:
score: 0
Accepted
time: 185ms
memory: 8184kb
input:
999 703 452 676632052 694 249 322223635 100 478 551236322 850 817 798208391 417 5 165267870 121 739 702829359 976 111 753918495 177 379 672291654 978 433 859958521 519 330 963297314 161 358 634960104 769 617 422024554 902 550 653749660 478 331 325762522 803 487 669926356 900 357 998094270 229 247 13...
output:
249320139378454
result:
ok single line: '249320139378454'
Test #11:
score: 0
Accepted
time: 157ms
memory: 8272kb
input:
999 488 240 90329282 153 232 869391745 327 202 129503686 861 463 206100446 671 14 574730119 6 638 190086953 15 145 600388818 970 540 513243490 124 336 768408766 374 892 424284727 157 831 657844405 543 801 35315910 384 228 40550504 696 726 407004570 564 117 745989501 602 406 385700975 130 860 8794247...
output:
249381414288671
result:
ok single line: '249381414288671'
Test #12:
score: 0
Accepted
time: 168ms
memory: 8308kb
input:
999 604 617 1000000000 327 435 1000000000 288 310 1000000000 855 472 1000000000 383 336 1000000000 718 282 1000000000 793 474 1000000000 386 624 1000000000 664 450 1000000000 963 626 1000000000 669 804 1000000000 679 329 1000000000 804 424 1000000000 960 553 1000000000 491 827 1000000000 414 293 100...
output:
498501000000000
result:
ok single line: '498501000000000'
Test #13:
score: 0
Accepted
time: 160ms
memory: 7892kb
input:
999 761 969 999999999 379 174 1000000000 715 859 1000000000 650 60 999999999 229 649 999999999 432 139 999999999 273 965 1000000000 937 597 999999999 820 327 1000000000 316 537 999999999 664 607 999999999 591 9 999999999 150 81 999999999 940 443 999999999 864 964 999999999 712 592 999999999 904 154 ...
output:
498500999750904
result:
ok single line: '498500999750904'
Test #14:
score: 0
Accepted
time: 181ms
memory: 8104kb
input:
999 701 661 912773717 793 318 676831184 460 13 994559899 984 586 517906561 228 912 954859169 865 234 838798922 597 969 681354225 53 562 579861793 810 226 792730447 121 368 748216928 42 180 600714771 977 884 566113909 476 554 874809102 443 584 607386706 388 691 771256305 113 454 975302522 785 262 502...
output:
374007334559178
result:
ok single line: '374007334559178'
Test #15:
score: 0
Accepted
time: 123ms
memory: 8032kb
input:
999 215 843 2 734 157 2 812 222 5 210 328 1 745 402 2 777 973 4 442 554 5 486 199 1 827 557 5 205 111 4 644 648 5 874 414 1 419 960 5 213 503 1 468 893 3 158 574 1 235 928 1 953 134 3 565 384 3 774 10 1 890 723 1 265 531 4 837 755 3 19 768 4 902 280 3 390 615 2 885 753 2 585 970 5 918 966 5 411 903 ...
output:
1496749
result:
ok single line: '1496749'
Test #16:
score: 0
Accepted
time: 136ms
memory: 8232kb
input:
999 38 634 999999999 410 438 999999998 875 291 999999998 139 144 1000000000 479 149 1000000000 585 242 999999999 783 537 999999999 445 877 999999999 683 909 999999996 854 113 999999998 688 642 999999995 491 466 999999996 939 67 999999996 409 431 1000000000 972 895 999999998 570 17 1000000000 656 586...
output:
498500998755576
result:
ok single line: '498500998755576'
Test #17:
score: 0
Accepted
time: 151ms
memory: 7684kb
input:
999 239 392 999999990 783 613 999999997 88 328 999999992 921 479 999999994 439 714 999999991 51 563 999999997 341 766 999999994 716 61 1000000000 204 202 999999992 140 772 999999997 243 490 999999997 85 941 999999999 284 202 999999995 141 306 999999992 425 85 999999992 225 882 999999997 802 792 9999...
output:
498500997511441
result:
ok single line: '498500997511441'
Test #18:
score: 0
Accepted
time: 101ms
memory: 7808kb
input:
999 766 542 1 780 561 1 452 821 1 939 594 1 376 592 1 398 461 1 838 681 1 19 355 1 258 162 1 194 198 1 971 8 1 486 86 1 815 126 1 877 859 1 783 568 1 88 278 1 223 911 1 393 477 1 232 848 1 429 62 1 659 28 1 320 530 1 56 912 1 621 647 1 783 172 1 87 476 1 529 849 1 573 564 1 903 123 1 831 450 1 631 1...
output:
498501
result:
ok single line: '498501'
Test #19:
score: 0
Accepted
time: 164ms
memory: 7900kb
input:
999 506 4 678834369 695 821 678834327 540 30 678834270 533 210 678834346 417 699 678834332 873 531 678834355 370 32 678834412 97 282 678834342 63 22 678834397 336 536 678834353 89 235 678834256 248 672 678834385 381 859 678834280 112 942 678834279 170 594 678834345 645 713 678834271 479 138 67883438...
output:
338399594103017
result:
ok single line: '338399594103017'