QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#450360 | #8519. Radars | masterhuang | AC ✓ | 243ms | 4676kb | C++20 | 895b | 2024-06-22 10:57:58 | 2024-06-22 10:57:59 |
Judging History
answer
#include<bits/stdc++.h>
#define P pair<int,int>
#define fi first
#define se second
#define LL long long
#define fr(x) freopen(#x".in","r",stdin);freopen(#x".out","w",stdout);
using namespace std;
const int N=505;
int T,n,m,a[N][N];LL f[55],g[55],h[55];
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin>>T;
while(T--)
{
cin>>n;m=n/2+1;
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) cin>>a[i][j];
memset(f,0x3f,sizeof(f));memset(g,0x3f,sizeof(g));g[0]=0;
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++)
{
int s=0;
if(i<=m&&j<=m) s|=1;
if(i<=m&&j>=m) s|=2;
if(i>=m&&j<=m) s|=4;
if(i>=m&&j>=m) s|=8;
for(int t=0;t<16;t++) if((t&s)==t) f[t]=min(f[t],(LL)a[i][j]);
}
for(int i=1;i<16;i++)
{
memcpy(h,g,sizeof(g));
for(int j=0;j<16;j++) if((i&j)==0) g[i|j]=min(g[i|j],h[j]+f[i]);
}cout<<g[15]<<"\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3604kb
input:
2 3 1 1 1 1 1 1 1 1 1 5 8 5 2 8 3 5 6 9 7 3 7 8 9 1 4 8 9 4 5 5 2 8 6 9 3
output:
1 5
result:
ok 2 number(s): "1 5"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
1 1 444739567
output:
444739567
result:
ok 1 number(s): "444739567"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
32 5 177252602 814271963 432801178 401470194 888319541 320323627 34071000 116035631 87392694 926990496 423510770 515133425 777623990 140441392 853473387 976288681 925949889 930584554 939702106 761328886 840677679 912446055 378955738 997133668 334407172 3 633852912 89450314 828384045 327867173 732812...
output:
494991369 661643843 47298040 226890388 50684672 954430705 139405747 530064327 199272913 211829225 333898451 217089022 35580250 251879512 230866303 60323753 215243437 114032585 351186098 361741480 49710371 75128942 269414925 755829169 133537759 108744675 691515792 193230413 469380143 156043031 227141...
result:
ok 32 numbers
Test #4:
score: 0
Accepted
time: 30ms
memory: 4504kb
input:
8 43 989947367 331735816 349317917 700365413 17189378 612200624 154937171 346672308 376889862 872720288 638190204 958149220 927650750 20485214 849210362 571686855 199779982 519793060 418047026 334316854 663198223 597430022 731510780 865566541 833977935 78042080 441551911 425178608 47859112 268111727...
output:
4223743 95074 47405673 99139301 77400585 170038233 140844122 53719
result:
ok 8 numbers
Test #5:
score: 0
Accepted
time: 243ms
memory: 3584kb
input:
500000 1 965486862 1 216509339 1 482967094 1 753780237 1 701167068 1 946858197 1 92693705 1 41962139 1 260677329 1 616111269 1 487286424 1 717653655 1 871004981 1 393162462 1 100430388 1 740632872 1 835913896 1 610746520 1 298859058 1 950834347 1 314912345 1 869919263 1 12617927 1 759608365 1 686606...
output:
965486862 216509339 482967094 753780237 701167068 946858197 92693705 41962139 260677329 616111269 487286424 717653655 871004981 393162462 100430388 740632872 835913896 610746520 298859058 950834347 314912345 869919263 12617927 759608365 686606085 694042166 703198383 514097106 492535170 681684788 239...
result:
ok 500000 numbers
Test #6:
score: 0
Accepted
time: 57ms
memory: 3616kb
input:
55560 3 493633806 683976517 397047281 10227143 558843035 584286153 220557051 96550579 356192384 3 133291149 782667966 675946232 698472590 618998483 737004700 539126624 205091987 827255113 3 334646943 95863066 247302090 388453188 753491791 459811227 215101157 511216316 59214807 3 965812864 732816430 ...
output:
503825003 618998483 370179030 237650274 261030238 404713637 109378708 122850558 362696567 579428679 152208850 543018323 221113942 203407403 668013330 406259646 517295921 418510489 285649976 297902289 422735958 688213753 362808993 478501743 462150678 344729390 570606284 283348525 557825550 522690094 ...
result:
ok 55560 numbers
Test #7:
score: 0
Accepted
time: 46ms
memory: 3548kb
input:
20000 5 191715144 307819948 647339769 872468351 220142014 762671875 336586001 50513205 768621310 730515581 841271229 909218925 79462648 426794914 209648319 250847163 500498427 682183527 40040994 957657573 924048461 670314366 956633884 187180524 1320869 5 318800896 333730442 641040543 122819902 79441...
output:
79462648 261789157 336265025 238367794 183374931 180253071 238854192 315419806 342599404 108204489 267761956 193298726 271154360 231785052 162497139 200671633 115603664 595344479 467752988 84131368 222080540 53991807 253564769 352253093 195658148 224875040 39708507 302710382 319032903 46968864 24230...
result:
ok 20000 numbers
Test #8:
score: 0
Accepted
time: 41ms
memory: 3632kb
input:
10208 7 517976277 574115680 281419819 632483546 184869183 262238366 770188155 94990145 573813914 139809352 604368201 890802309 327920560 53269651 269678147 623707154 16686153 193733690 67672476 531424446 909555554 851796738 984263939 773103233 185539003 780693162 342686813 812274472 235491436 483153...
output:
185539003 78222201 114308521 145547210 509726982 213353860 20659945 57996908 219254076 123498630 85739680 161914328 263958537 126424568 94684933 144921561 7089136 165579720 256544532 120748595 210368961 122128548 107554324 165194363 95803159 158889756 71971738 51629656 196973154 107973038 161137619 ...
result:
ok 10208 numbers
Test #9:
score: 0
Accepted
time: 35ms
memory: 3620kb
input:
6176 9 548204560 360664933 563328183 481692591 546820326 877551285 556159099 50123424 653594346 569182180 736041356 145734210 812269303 541214779 757680193 155889520 507721150 814285552 488057270 771638587 216168468 47977162 299901421 970641686 211678330 675512585 924471267 976296094 187000760 90786...
output:
166854971 98717109 144774794 95476403 34227399 174527080 232708249 191208388 108164322 108372863 103790056 77488381 83491055 195309658 63707424 91983249 54350691 40654039 98516471 84399644 46546580 124388006 125258549 70546068 150531424 84160438 31465908 21530512 68210481 52049530 125276670 48408340...
result:
ok 6176 numbers
Test #10:
score: 0
Accepted
time: 37ms
memory: 3556kb
input:
2224 15 385628084 142437445 653089425 177506041 540742227 129951388 42788902 835538162 922570578 986887078 865959271 713948074 96089013 288223221 372901255 898658003 549129013 161628958 541356507 197719459 350620927 485068035 262670295 690782580 208710451 885953833 114803159 689644678 704189654 2455...
output:
107327318 94130491 48643994 36146272 52246772 65191894 38998737 67637986 78352392 140657039 6703841 46005930 54622417 20988817 4202339 53928821 36514606 45175716 24478282 59773264 7994371 41531038 45648152 26744624 63718404 24799422 37849846 60405704 46444689 61294072 75928047 40142899 81606049 3945...
result:
ok 2224 numbers
Test #11:
score: 0
Accepted
time: 32ms
memory: 3668kb
input:
528 31 412377136 643175275 719397952 623370419 539554915 227316428 468092525 859952203 673749099 85957482 11334623 571703077 640519829 749987404 969113492 406625418 456525661 196038403 5486651 121584516 684735350 896993176 567999698 104152829 16785018 283710468 732740435 47986146 34763201 263276650 ...
output:
5089073 3127195 13395887 17595001 5869268 8711481 8509094 5806021 6302191 15838881 10764305 8696715 27361287 4373547 3530917 13302829 7245220 20089478 16040889 7859869 2211863 4838443 25322366 35026791 10562079 10533881 6979605 21305751 10056217 14287294 2166706 12810397 6824927 3904661 21933252 576...
result:
ok 528 numbers
Test #12:
score: 0
Accepted
time: 19ms
memory: 4536kb
input:
1 499 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 10000000...
output:
1000000000
result:
ok 1 number(s): "1000000000"
Test #13:
score: 0
Accepted
time: 30ms
memory: 4568kb
input:
2 499 754140336 523656574 832911097 889895544 684680198 951798129 661753807 821780498 656793711 995692020 512521382 885458816 514260359 848493411 665387734 844550291 901799958 663293484 898552528 764371565 776512161 878320439 614469617 938268611 654582614 835876273 681533952 547006101 904634625 5109...
output:
108707695 89792425
result:
ok 2 number(s): "108707695 89792425"
Test #14:
score: 0
Accepted
time: 34ms
memory: 4632kb
input:
2 499 774427879 867961112 787223922 666746087 602105440 865163968 708116436 834002400 852575639 848704311 673456993 843399191 902793674 583038217 760517770 842227353 571461361 962448999 859647780 570301225 890464126 839537740 535269960 622834968 695454058 525640595 537574098 788899467 811790114 7204...
output:
138338565 9968710
result:
ok 2 number(s): "138338565 9968710"
Test #15:
score: 0
Accepted
time: 35ms
memory: 4592kb
input:
2 499 597221737 726351704 541244108 883815984 518849811 857218286 857028263 994235408 568279737 574568133 908520015 882251660 642323156 933616795 867630144 526009127 538967401 583676731 604075065 580891909 535285878 581895732 607541352 550959577 916134952 912609963 808987374 897492397 706853738 5009...
output:
193517556 74162804
result:
ok 2 number(s): "193517556 74162804"
Test #16:
score: 0
Accepted
time: 34ms
memory: 4548kb
input:
2 499 796027152 843910855 596607122 798828882 518583484 768991870 810395449 924804188 624961157 744240077 621912140 531676188 695221004 656048786 671763071 615707736 692548849 718721800 963084376 782394674 604870128 880169737 564992841 737492238 534269702 770120023 861712947 801749428 729816991 9415...
output:
50214365 98740005
result:
ok 2 number(s): "50214365 98740005"
Test #17:
score: 0
Accepted
time: 34ms
memory: 4604kb
input:
2 499 911810338 972513706 765425498 743881262 753146052 768565966 559288114 625219600 696485183 658825949 686422563 757390012 874068308 805020920 509688779 649701728 967794425 597113159 599282197 586475953 651752407 841397557 623428731 741965778 918115737 671480204 931637519 762276665 965224190 8420...
output:
111129330 93324655
result:
ok 2 number(s): "111129330 93324655"
Test #18:
score: 0
Accepted
time: 31ms
memory: 4532kb
input:
2 499 589230293 511890930 961005897 646847821 869391672 667634542 894127545 989765026 757586886 937287578 615850170 997375061 746053207 512900967 591576350 695747570 619090213 632330636 774111311 579752528 656920989 703380992 823181747 858552177 786067878 917700551 915884156 658662130 525094999 7654...
output:
73340315 110265349
result:
ok 2 number(s): "73340315 110265349"
Test #19:
score: 0
Accepted
time: 34ms
memory: 4528kb
input:
2 499 526267406 825632409 685875980 822835070 727385095 975331628 984333348 623175855 629451225 690068764 912929763 718981854 610836068 639827773 571466490 860144480 955527947 792915977 825987386 705988597 542046349 705579705 537071949 792789867 789065382 695636961 508888905 792558242 526445495 7677...
output:
37158918 53198670
result:
ok 2 number(s): "37158918 53198670"
Test #20:
score: 0
Accepted
time: 31ms
memory: 4612kb
input:
2 499 789744840 926925733 831735712 919767051 674641552 563940439 977012191 829333995 940870884 719830540 631015831 918305522 700888434 842256602 506962792 617088676 503108584 639025626 533805376 873939322 749273550 942802691 942876835 517564476 688698566 749509717 853722850 658241967 851922313 5557...
output:
68216751 166805498
result:
ok 2 number(s): "68216751 166805498"
Test #21:
score: 0
Accepted
time: 35ms
memory: 4540kb
input:
2 499 753432944 531069938 601587863 945731624 715955884 834372751 719004530 623770383 682135994 695980769 774540651 930228345 942240061 930330327 803473290 891108035 957039952 962032683 823906758 587182165 501061686 795738914 863994268 758664445 686604290 642651448 754274905 537286380 897829394 7465...
output:
83342846 269307653
result:
ok 2 number(s): "83342846 269307653"
Test #22:
score: 0
Accepted
time: 34ms
memory: 4676kb
input:
2 499 784110028 631158456 922023233 657376172 581809040 509703044 519105197 550748964 549091314 551960736 571771745 948624718 900470914 856183443 846661996 788516423 995211162 810941355 713558761 752421604 840569482 927172543 854177989 726694791 598939684 758485261 971754660 975283053 815052623 8916...
output:
88275095 74624445
result:
ok 2 number(s): "88275095 74624445"
Test #23:
score: 0
Accepted
time: 31ms
memory: 4536kb
input:
2 499 668595313 978197730 766959870 631101672 670878147 919976737 997718716 753030631 666705477 782696890 762193372 865848119 769359275 640265900 952705210 814237061 594065535 988341211 818510306 628640988 994174040 586563177 694187529 662217946 683095727 700489311 515214059 519224722 749675061 5301...
output:
73323072 96283661
result:
ok 2 number(s): "73323072 96283661"
Test #24:
score: 0
Accepted
time: 27ms
memory: 4660kb
input:
2 499 800293486 801324685 825346934 644199793 953006693 940056656 831046877 765550960 549219334 963360857 934759994 742861061 737881121 866064967 624130648 603949893 840397501 810925311 704419301 777622308 626467058 935949963 994192899 854154860 836494227 851418963 606975996 642374959 761293591 9966...
output:
29393776 94703893
result:
ok 2 number(s): "29393776 94703893"
Test #25:
score: 0
Accepted
time: 36ms
memory: 4344kb
input:
4 353 650895816 974672006 672032135 819312472 643053616 793445832 674127629 849661045 685143654 777346072 962640370 883630875 664148861 625170512 751715785 528314606 803503395 613184593 928076245 715593096 778954029 671552435 859078893 687123189 933579784 949072830 809293751 927632933 647191139 6531...
output:
136317716 141039568 157805674 106150756
result:
ok 4 number(s): "136317716 141039568 157805674 106150756"
Test #26:
score: 0
Accepted
time: 31ms
memory: 4488kb
input:
4 359 934548289 846131024 590720141 875132190 830452189 722368925 598929858 877994106 528959491 732853265 881148254 689234612 664040319 595013644 624547353 600914540 673573796 822755827 718990226 646448219 626296040 619172722 687744086 969396376 816913551 514088901 653474723 530703860 774152001 9487...
output:
135786834 104579202 85957290 90468786
result:
ok 4 number(s): "135786834 104579202 85957290 90468786"
Test #27:
score: 0
Accepted
time: 23ms
memory: 4368kb
input:
5 333 659208897 556161384 829905683 811476451 869720754 876714771 669807953 825024153 514749610 743366777 598658941 646374970 626476823 614596700 759805211 672304074 576500178 505131748 941072083 778949208 654940521 714656855 591765688 932327939 931152510 945543887 644350894 563956868 587312010 6847...
output:
175019075 61098927 129823465 192937637 129798224
result:
ok 5 number(s): "175019075 61098927 129823465 192937637 129798224"
Test #28:
score: 0
Accepted
time: 34ms
memory: 4436kb
input:
4 431 962381830 846454802 513316704 624509175 626939721 961061822 658904648 877548758 657764303 899216805 925176702 670923975 691969735 812933301 907945188 628084706 634489129 878782541 781456939 801836896 573537102 523505750 743822824 974451817 929453701 808409531 681572133 617660902 774556554 9677...
output:
209533661 109009951 84041663 182339479
result:
ok 4 number(s): "209533661 109009951 84041663 182339479"
Test #29:
score: 0
Accepted
time: 33ms
memory: 4488kb
input:
4 275 668255744 940396696 818646936 836410585 500951740 511176492 667966830 903647796 653432145 978897047 827690313 944997316 732443641 834587388 907923848 903701076 702377704 992449686 675114140 515661712 933551211 688535778 781726177 544112696 808111502 666444466 950019695 751633103 545647497 8859...
output:
35430052 118143342 69458886 52982191
result:
ok 4 number(s): "35430052 118143342 69458886 52982191"
Test #30:
score: 0
Accepted
time: 27ms
memory: 3628kb
input:
594 39 597963079 866667637 921553711 675718119 717301621 622689684 788857591 618935354 558964344 974529707 606104087 859554002 801976103 677127801 691962863 602970599 655122969 781890361 880002393 503500584 872196070 548734047 854669288 535173564 695591998 803519510 549637761 770806809 750729200 767...
output:
81629325 21083654 69178639 35446004 174943229 59937584 8150762 152268603 121037012 12159905 195931959 200243846 88201369 188619000 117783633 210921194 103076368 85222114 57773111 140422516 67259220 96197533 179152488 114936538 36125345 171119532 164517511 171457319 231983896 171898544 114206371 1216...
result:
ok 594 numbers
Test #31:
score: 0
Accepted
time: 35ms
memory: 3764kb
input:
126 63 546234505 593871652 574388073 618538678 929824045 719773865 895524679 714724185 758781585 544690042 942687831 526787443 801440147 580004753 737441728 582984454 903867093 815725808 531680615 999911379 981143166 907375007 718644296 807918825 879691103 637837658 986842463 711693400 913142015 523...
output:
72615712 119771566 61964203 129768638 124862365 89333824 89073143 58626092 67382312 124816192 159171148 89206365 76410710 126200090 127550962 187728310 160232236 102092695 184685164 121161160 84791813 23789829 191183527 54965514 138320905 176836677 3440889 101199939 218042283 213448919 156465359 180...
result:
ok 126 numbers
Extra Test:
score: 0
Extra Test Passed