QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#638603 | #9437. Solve with Friends | arbuzick# | AC ✓ | 63ms | 11124kb | C++20 | 838b | 2024-10-13 16:21:21 | 2024-10-13 16:21:21 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n;
cin >> n;
vector<int> a(n), b(n), c(n), d(n);
for (auto& el : a)
cin >> el;
for (auto& el : b)
cin >> el;
for (auto& el : c)
cin >> el;
for (auto& el : d)
cin >> el;
int cursum = 0;
for (auto el : d)
cursum += el;
for (auto el : b)
cursum += el;
vector<int> diffs(n);
for (int i = 0; i < n; ++i)
diffs[i] = (a[i] - b[i]);
int ans = cursum;
sort(diffs.begin(), diffs.end());
for (int i = 0; i < n; ++i) {
cursum -= d[n - i - 1];
cursum += diffs[i];
cursum += c[i];
ans = min(ans, cursum);
}
cout << ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
3 1 3 5 6 4 2 1 2 3 1 2 3
output:
10
result:
ok "10"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
5 2 4 3 1 2 9 2 5 3 8 1 2 8 3 2 5 4 3 2 1
output:
28
result:
ok "28"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
8 21 85 72 22 81 20 88 28 75 22 78 92 55 56 73 44 39 14 64 27 73 42 16 84 27 7 91 85 69 95 70 27
output:
621
result:
ok "621"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
11 141 130 761 372 345 44 748 993 177 653 57 193 204 209 98 848 495 120 505 288 454 73 209 689 533 543 201 437 362 861 541 308 673 320 126 38 405 551 627 577 591 195 305 432
output:
6332
result:
ok "6332"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
40 363 411 688 848 677 296 110 36 879 755 88 877 812 668 660 656 680 577 124 719 302 627 832 721 846 79 992 834 356 826 261 846 342 896 291 385 18 412 272 694 911 939 402 895 617 616 934 492 475 304 697 769 39 918 206 638 487 50 959 537 569 830 889 829 22 104 744 945 399 641 376 72 810 177 298 44 27...
output:
35024
result:
ok "35024"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
14 95 758 610 430 691 196 4 739 270 956 876 16 879 807 353 263 770 777 298 457 838 79 574 490 27 859 780 941 911 519 24 902 556 162 268 712 940 215 599 566 179 18 763 867 232 683 948 804 805 148 306 378 135 70 901 755
output:
12611
result:
ok "12611"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
11 11 229 702 188 664 569 440 715 775 211 956 169 341 176 192 427 589 152 383 810 55 410 352 17 13 571 12 309 424 41 972 370 863 206 598 934 843 232 601 700 841 483 283 428
output:
7533
result:
ok "7533"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
10 858 354 617 549 321 695 13 950 207 272 156 658 70 432 618 349 890 972 690 345 257 278 319 547 50 697 978 555 987 388 601 442 661 275 804 182 152 397 176 710
output:
7251
result:
ok "7251"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
20 833 921 562 268 97 952 164 611 564 469 342 771 533 903 260 871 778 964 978 257 895 690 823 275 129 7 125 13 139 903 129 161 166 735 236 815 842 637 400 910 365 210 421 999 947 290 794 919 889 302 444 207 908 242 361 713 186 344 418 281 884 155 324 199 43 692 192 263 835 745 935 865 488 739 362 55...
output:
17556
result:
ok "17556"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
7 529 303 448 872 618 418 587 192 345 179 580 289 586 876 797 286 350 377 108 211 377 362 330 759 747 454 396 947
output:
5719
result:
ok "5719"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
34 5 882 704 639 163 46 756 126 688 528 530 64 420 98 266 401 163 583 475 11 947 876 26 161 73 269 148 424 573 192 787 330 334 941 625 285 576 325 15 899 697 499 762 918 459 747 448 777 312 512 327 194 16 742 121 954 613 783 452 302 977 325 897 691 408 491 65 68 541 671 526 967 557 663 939 864 478 5...
output:
28871
result:
ok "28871"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
37 453 881 251 788 634 664 32 307 65 246 157 652 625 59 766 525 420 234 167 512 723 329 519 710 76 786 570 251 155 685 837 949 503 261 169 839 637 232 379 261 799 345 789 692 601 180 306 764 335 684 713 95 67 251 121 825 384 79 124 341 972 762 141 150 355 784 822 893 221 106 922 284 532 561 964 216 ...
output:
29187
result:
ok "29187"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
33 632 428 227 22 468 111 352 234 244 932 636 333 669 642 767 232 496 585 124 410 526 639 238 376 775 983 418 79 30 362 246 286 712 844 770 852 841 398 915 951 80 100 767 561 491 626 414 320 901 110 374 317 734 347 802 306 872 643 507 400 249 398 28 666 578 620 289 475 230 881 237 996 13 276 461 904...
output:
24593
result:
ok "24593"
Test #14:
score: 0
Accepted
time: 1ms
memory: 3524kb
input:
769 447040672 441035275 440050901 1812839 403614015 713651056 637121294 744115913 485123083 541990146 676486668 933001858 36637012 504195819 48650468 550879589 831250106 365665984 723728794 362464150 597604335 155032923 740664647 461753890 765470796 766872615 704932835 138868943 729334132 82099448 8...
output:
619566247863
result:
ok "619566247863"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
386 406027879 481265607 133900424 975297532 82942773 302298908 865179778 464746606 598174500 74119666 188711202 909567219 233900160 191173287 413890294 554630222 517362947 157763526 463019261 557716319 845796102 27076594 883524018 612484941 71541493 880763951 394945686 686267964 124713046 108124650 ...
output:
308704812875
result:
ok "308704812875"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
211 459882217 446767163 139128402 795102655 573320724 42284179 926851120 814131922 423156194 594047114 498370095 919963365 439899823 683870364 476720601 756025894 940194579 665614627 742718766 625601975 412449710 17011208 292047805 373583417 648039111 630022817 625355382 562936856 540531934 86437952...
output:
175437355791
result:
ok "175437355791"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3580kb
input:
594 403346078 505392787 838747224 741934860 335395715 924942050 940655541 896801793 433758482 545558829 525808137 362142751 564552056 843644343 369685080 626948789 499782718 455547647 610093171 675243992 448440973 353565661 290813178 24302074 423064788 131536699 976627330 958021289 705160841 7497403...
output:
482276640149
result:
ok "482276640149"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
537 739776591 568582227 933001863 36712644 701592616 908124855 688158756 611031174 334133061 104610919 480342160 719654047 597668025 151737333 112516515 205716422 27224481 147826953 962752912 772653663 156492229 571158648 211494846 508440937 529396746 546360501 40865735 709382929 843412979 776126030...
output:
448540617602
result:
ok "448540617602"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
895 489141410 432277154 344949477 433754863 484734296 450097978 285561285 876307774 661898089 555881960 80487043 904775915 237090595 125714753 837686847 100039394 956132777 103452538 338793920 56515016 660101938 432751564 802165583 94609212 959118901 899106322 511263335 720799698 525271559 97437018 ...
output:
736096339354
result:
ok "736096339354"
Test #20:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
531 900911435 785026468 874062332 503718217 611536645 239657973 325972263 385032341 870318373 929766891 427371238 569339675 778520113 405848303 684357246 69811787 800624444 926302836 189057322 284355118 436240137 378803298 331749551 847156045 335068705 797602501 712309733 642092330 540455732 6573943...
output:
432979643757
result:
ok "432979643757"
Test #21:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
903 638025025 900745704 147077602 179570714 830457760 710730120 937082226 969647108 679280493 644178399 167545643 588552281 488500282 394248690 76931608 204380162 117289358 965985380 339910340 566583360 624040722 608048186 664927853 482569705 577030636 117749400 107985090 281717512 698515969 7385346...
output:
736580095059
result:
ok "736580095059"
Test #22:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
789 976020861 428764814 368851390 573756261 919903597 11238203 975650305 643289467 259642644 127147004 213467463 376218328 909573525 339885102 142408294 85672677 12888622 796963431 708870075 813810389 387860180 79434792 399454130 591682388 482867683 216437765 905951757 672122669 601714663 517847318 ...
output:
633361476791
result:
ok "633361476791"
Test #23:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
957 40295710 792649165 139711991 939798163 445493453 206720902 803400892 455352928 558684812 802926456 229766811 515186768 89936669 810841815 960902667 814090426 799466342 899364135 549367536 114228872 354267917 282469712 455839487 146347337 790908741 953168477 748328143 413112342 364501243 47528803...
output:
817311141016
result:
ok "817311141016"
Test #24:
score: 0
Accepted
time: 11ms
memory: 4392kb
input:
33343 178524003 418255159 900472279 920324341 640223266 265618369 703159090 392316189 883392233 545066497 841110397 731336002 441523606 57503834 99288485 146765273 298966328 689082540 30933106 201661565 596719586 317442009 898457712 347493300 238115084 164432200 874273535 832181568 988353885 4777356...
output:
27721390263794
result:
ok "27721390263794"
Test #25:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
14306 655185187 475029513 550567269 950788580 477846733 654943575 709223923 318491188 278398165 744834166 745641196 350750700 224403885 574811063 394349812 702747239 986520793 807471288 147021796 315389499 761660494 77894488 281368566 202498068 697190205 891230942 219995966 579093848 434415132 84446...
output:
11891584582434
result:
ok "11891584582434"
Test #26:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
13072 8018264 545235111 453780425 973164075 733144570 773354924 131434201 327676864 43240517 893888130 855939918 862992397 208656138 42907412 664101512 7856902 955563061 191903734 879361368 444044919 557271905 892714365 455824386 966286653 34696534 102828374 585887807 803842351 358761577 645477283 5...
output:
10902124623672
result:
ok "10902124623672"
Test #27:
score: 0
Accepted
time: 7ms
memory: 4412kb
input:
33347 889685579 16892192 439229540 155842218 383842006 191719254 248287501 407294783 299284665 670663381 771523188 483951727 182354273 369102042 491505535 437670156 790820917 550860736 514387735 619241147 880195864 510775485 37697513 74416723 886372504 168607086 174613782 197430449 351313325 1675744...
output:
27798324591741
result:
ok "27798324591741"
Test #28:
score: 0
Accepted
time: 15ms
memory: 4908kb
input:
46338 49208288 262492321 777028109 663370556 607581292 334024756 431812431 50534377 1491851 377469413 461731053 381649337 920486790 149286542 798011698 73490948 359257608 392335712 137773471 571347228 159725032 144054074 902751549 573317988 94940952 92230543 709284891 269430137 343034456 460251621 2...
output:
38611050886814
result:
ok "38611050886814"
Test #29:
score: 0
Accepted
time: 63ms
memory: 10980kb
input:
200000 670780296 394992126 566670985 828982857 720688270 605955394 730815064 910648538 704622382 864292488 390428092 963479312 976068988 117418117 788524830 421194353 713360943 935871804 833141380 819765804 428492680 969766549 345220720 503539253 630884751 959215402 179485565 279079327 187934425 545...
output:
189695542513001
result:
ok "189695542513001"
Test #30:
score: 0
Accepted
time: 59ms
memory: 11008kb
input:
200000 455722468 133054831 528030270 326903193 804766309 661308737 120298294 877286015 803037807 601404858 485625981 210224424 437257033 718656997 826088435 392511370 748544413 632715749 594277503 955254728 184430704 713910091 501725828 217421834 343618049 410993344 449558184 682898926 106090329 454...
output:
189917977120980
result:
ok "189917977120980"
Test #31:
score: 0
Accepted
time: 55ms
memory: 10956kb
input:
200000 437865860 664763158 196693572 657502455 572617727 917877662 127057593 664191017 244387793 169132647 223761908 328492443 671737068 369331777 937406793 861897739 944070942 123358515 770804430 379978561 563020956 686229394 202460925 952631807 124420624 368067797 575300586 911540692 995776750 485...
output:
190183087366638
result:
ok "190183087366638"
Test #32:
score: 0
Accepted
time: 63ms
memory: 11124kb
input:
200000 922693660 538890813 980283140 617736925 100769234 143622359 969072489 491305955 110533554 834077431 445847608 596273857 148238054 161905238 556413444 229183030 173234899 450834568 660248344 551875739 199644564 862692714 346572061 666949147 429380293 855492711 668947696 732996807 243364817 155...
output:
189992291322204
result:
ok "189992291322204"
Test #33:
score: 0
Accepted
time: 55ms
memory: 11124kb
input:
200000 600333284 729301166 407743890 137203833 467096760 174744295 899203450 875930795 574433560 298078415 604284861 571462748 833498432 378287827 736765392 231196922 734721215 234452435 689295207 189980891 580364355 118960395 939787412 638423022 953400926 166093372 682266108 163506180 149003104 135...
output:
190120484424506
result:
ok "190120484424506"
Test #34:
score: 0
Accepted
time: 55ms
memory: 11000kb
input:
200000 291854809 157087295 714735486 415495888 502273576 833479479 919975499 176918390 142243633 345411304 485450667 484955900 759333115 496062091 590016367 205302327 389693164 627588002 311579554 958394872 347489964 279808007 623690723 308262634 874742432 137527634 540511050 319352720 605501771 622...
output:
190044725049189
result:
ok "190044725049189"
Test #35:
score: 0
Accepted
time: 55ms
memory: 10988kb
input:
200000 618341034 590361189 632016563 654226863 280575981 646136262 667064962 228407754 257044610 291374913 681418215 945354058 213852657 213685125 619200271 920790342 762088296 631482344 265542718 311405140 174510825 420477977 484381166 763455189 441310769 581281849 506888120 670235646 904735987 445...
output:
189875246087344
result:
ok "189875246087344"
Test #36:
score: 0
Accepted
time: 63ms
memory: 10956kb
input:
200000 861337079 110992910 174253131 384382213 487005895 853869132 224992627 612083626 648795232 259217165 298284799 851755279 130945431 508833049 483142773 350878684 781109095 338996138 603931272 146204371 341541813 949166664 941554112 772678048 372309911 525030823 993049293 816266971 679406741 424...
output:
189775233522128
result:
ok "189775233522128"
Test #37:
score: 0
Accepted
time: 63ms
memory: 11028kb
input:
200000 585955067 666518334 704907370 590591095 201079411 282112706 704069573 468389025 418997277 294318206 757219785 410796553 977453573 692014268 792082531 266246144 322725864 389607930 268801987 329114628 391390531 164214340 239888165 779554320 619051720 723692329 629300899 109210198 276992008 539...
output:
189972320381793
result:
ok "189972320381793"
Test #38:
score: 0
Accepted
time: 59ms
memory: 10968kb
input:
200000 871859927 874831788 357042314 546832264 259555892 622551967 496551769 230091521 409857607 228973680 949656743 588385681 715650136 755632909 583717209 635794347 796674964 946191227 325516738 861638477 881621802 660165918 240283781 986213087 810536247 999892588 941159325 579935477 426992210 447...
output:
190221677250353
result:
ok "190221677250353"
Test #39:
score: 0
Accepted
time: 59ms
memory: 10936kb
input:
200000 931667192 122493890 214510164 543801442 876952469 582653706 164206790 129809719 765071885 327602963 771438237 472123733 928014870 868701933 428581982 339987616 614395852 872486372 682880668 845554092 757824159 921648363 167267714 994563667 515361428 700748629 504655635 866423754 793933175 233...
output:
190009866583279
result:
ok "190009866583279"
Test #40:
score: 0
Accepted
time: 55ms
memory: 11064kb
input:
200000 659217007 414878360 877704715 340741942 407451052 600999088 125114935 242998716 462033222 988004606 872622618 825291947 981387260 250296217 704564650 216011172 387981605 869251123 992047918 109090698 432845155 426835834 872261996 133027110 459674547 766822415 757739842 578265964 301589033 568...
output:
189949517947557
result:
ok "189949517947557"
Test #41:
score: 0
Accepted
time: 59ms
memory: 10952kb
input:
200000 850275905 551267462 730548856 993389477 108094518 869908668 309082480 882817674 374906379 157259735 408515095 230758790 904027052 358628619 381120811 450269883 850069960 813632636 444367563 434025482 560845522 647738155 763332622 251209564 525650819 762101179 864812925 564284163 458910569 221...
output:
189823377578986
result:
ok "189823377578986"
Test #42:
score: 0
Accepted
time: 59ms
memory: 11048kb
input:
200000 463529810 371363761 746029529 257789074 938968071 275557498 277006130 793998621 637027652 497549629 911811592 196898336 894543129 949866460 908671426 774689344 906962851 308478531 395923243 126633052 862654124 788529351 513993204 253577751 697212000 120332325 392300805 447601525 430791828 973...
output:
190048381686975
result:
ok "190048381686975"
Test #43:
score: 0
Accepted
time: 47ms
memory: 11052kb
input:
200000 98 39 18 71 60 48 44 44 87 18 76 41 40 36 53 51 52 64 91 90 22 97 34 23 13 38 23 54 10 38 11 50 78 73 48 31 13 96 30 58 76 28 63 98 21 56 71 100 56 95 92 35 53 85 58 48 24 74 84 88 83 73 42 80 43 45 92 75 68 88 92 88 86 11 71 45 63 41 99 60 15 34 23 41 32 74 75 76 57 65 89 13 75 72 72 33 12 7...
output:
21996100
result:
ok "21996100"
Test #44:
score: 0
Accepted
time: 43ms
memory: 11124kb
input:
200000 98 76 37 100 99 72 96 37 34 91 100 35 75 56 74 79 50 26 52 22 71 65 82 60 74 60 54 44 82 90 45 20 12 32 78 58 90 93 67 100 52 78 82 24 82 25 85 93 52 89 39 39 62 97 20 18 72 86 12 24 52 85 84 24 75 27 24 95 57 17 20 95 17 37 15 31 60 79 96 42 46 68 86 74 33 54 25 25 50 63 20 38 33 23 91 73 62...
output:
21999537
result:
ok "21999537"
Test #45:
score: 0
Accepted
time: 51ms
memory: 10952kb
input:
200000 38 96 47 35 81 64 52 80 37 30 46 53 90 14 17 83 43 10 70 42 91 50 18 16 72 22 93 52 14 24 69 26 97 80 20 58 97 82 21 52 17 79 83 44 92 19 58 60 44 53 11 58 33 61 70 90 43 30 70 14 87 44 11 73 44 64 29 10 39 10 64 75 92 62 80 69 42 25 53 21 26 42 95 100 44 69 63 76 73 10 97 29 77 32 57 87 97 2...
output:
21975545
result:
ok "21975545"
Test #46:
score: 0
Accepted
time: 40ms
memory: 11020kb
input:
200000 97 99 76 32 45 81 11 10 31 37 32 65 14 19 23 85 21 47 26 33 64 75 28 28 88 55 68 31 86 71 85 74 12 11 36 62 19 94 24 10 86 43 75 43 79 87 97 61 62 41 56 25 47 72 33 100 25 11 22 10 56 45 97 27 97 52 48 27 36 75 39 32 81 44 66 20 91 65 98 46 59 66 39 40 68 100 52 40 30 37 47 79 96 88 25 73 20 ...
output:
21996842
result:
ok "21996842"
Test #47:
score: 0
Accepted
time: 44ms
memory: 11120kb
input:
200000 748666707 540627360 126691243 949397508 526381926 148117049 275666254 806466579 246725796 809243422 746227687 350199109 423460943 153233427 367277016 762777018 395672940 197951825 330115752 457597197 503120656 123259591 181938989 711587202 115644455 257140380 827231076 269534238 824888723 630...
output:
22028851
result:
ok "22028851"
Test #48:
score: 0
Accepted
time: 52ms
memory: 10956kb
input:
200000 805790980 703093462 169010397 316581402 198850152 395912112 996498562 806072585 454757067 721272711 764970466 753731477 838604290 293088949 498192032 954454578 694961763 938507115 918073846 203096611 899188174 619187063 850918483 949137959 459109177 145164752 413282511 883018563 513207928 997...
output:
22014429
result:
ok "22014429"
Test #49:
score: 0
Accepted
time: 51ms
memory: 10996kb
input:
200000 114967500 403194204 980042523 181082155 269413466 942565770 595736475 780135191 731376718 931808002 178556047 762789250 601264567 275247194 205784504 977449238 619155923 327556906 579920038 167517340 992584570 521868678 529618978 866158838 619659660 203930077 948615934 275377994 256648053 186...
output:
22002416
result:
ok "22002416"
Test #50:
score: 0
Accepted
time: 43ms
memory: 10952kb
input:
200000 432303559 594708896 689484114 143715370 384824719 408011473 339504020 473091865 804045144 351848641 229849453 636379622 969707074 419366219 359147433 494078718 541454481 233999331 590160640 482623394 211618823 250600909 440016380 301322396 365032126 613874610 685100666 559282252 126848625 373...
output:
21990390
result:
ok "21990390"
Test #51:
score: 0
Accepted
time: 47ms
memory: 10952kb
input:
200000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
output:
400000000000000
result:
ok "400000000000000"
Test #52:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
1 162449908 649850599 816901158 600777819
output:
979351066
result:
ok "979351066"
Test #53:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
1 590029449 425179904 935103339 802452007
output:
1227631911
result:
ok "1227631911"
Test #54:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
1 978418990 811650435 398697481 565555111
output:
1377116471
result:
ok "1377116471"
Extra Test:
score: 0
Extra Test Passed