QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87310 | #5748. Determinant, or...? | EwiGKeiT | TL | 561ms | 5828kb | C++14 | 862b | 2023-03-12 14:35:20 | 2023-03-12 14:35:21 |
Judging History
answer
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD=1e9+9;
const LL INF=1e9;
void rd(LL &x)
{
x=0; LL fl=1; char c=getchar();
while (!isdigit(c)) { if (c=='-') fl=-1;c=getchar(); }
while (isdigit(c)) { x=(x<<1)+(x<<3)+(c^48);c=getchar(); }
x*=fl;
return;
}
int Cnt(int x)
{
int ret=0;
for (;x;x>>=1) ret+=x&1;
return ret;
}
int n;
LL a[2000005];
signed main()
{
scanf("%d",&n);
for (int i=0;i<(1<<n);i++) rd(a[i]);
for (int i=0;i<(1<<n);i++)
for (int j=i+1;j<(1<<n);j++)
if ((i|j)==j)
if ((Cnt(i)-Cnt(j))&1) a[i]=(a[i]-a[j]+MOD)%MOD;
else a[i]=(a[i]+a[j])%MOD;
LL ans=1;
for (int i=0;i<(1<<n);i++)
ans=ans*a[i]%MOD;
printf("%lld\n",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3588kb
input:
1 5 2
output:
6
result:
ok 1 number(s): "6"
Test #2:
score: 0
Accepted
time: 2ms
memory: 3612kb
input:
2 3 1 5 4
output:
999999997
result:
ok 1 number(s): "999999997"
Test #3:
score: 0
Accepted
time: 2ms
memory: 3728kb
input:
3 53 37 42 42 84 37 66 8
output:
47229676
result:
ok 1 number(s): "47229676"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3596kb
input:
3 762493332 721658786 22070969 135208254 466384641 652280022 979534282 601978718
output:
281502235
result:
ok 1 number(s): "281502235"
Test #5:
score: 0
Accepted
time: 2ms
memory: 3756kb
input:
3 129388930 489520730 263815343 315708585 263026886 153021985 251231378 649675390
output:
346896861
result:
ok 1 number(s): "346896861"
Test #6:
score: 0
Accepted
time: 2ms
memory: 3580kb
input:
4 354170434 589724459 964138381 855919536 741407874 653645432 210017100 9041114 623557907 889004048 499789082 377902011 20698775 389133769 126649035 441324014
output:
474257110
result:
ok 1 number(s): "474257110"
Test #7:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
4 937789215 253802096 74184353 604319027 576369232 865942568 553877713 711393269 254598038 59465342 443665488 598315393 794989360 347520873 716201483 332154787
output:
68449605
result:
ok 1 number(s): "68449605"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 945847544 457790131 906205784 732202587 450793841 105549871 579895409 866642556 582933159 465747387 640078680 305986861 929552595 868736660 77365410 391848608 712146473 133745404 234695094 465735106 317508101 204342520 670426418 689063750 795934489 878985583 697138558 46785510 766258117 700869396 ...
output:
213587651
result:
ok 1 number(s): "213587651"
Test #9:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
5 117731836 936733644 100262701 991557887 122142847 311498255 185976389 994248761 554366984 980490190 47411526 31108007 254929832 619096099 403435369 290576856 964262084 411209784 393093339 810450341 643067658 791080885 69870586 491932883 729222005 831984691 815330144 773466314 394086029 755332964 4...
output:
791285614
result:
ok 1 number(s): "791285614"
Test #10:
score: 0
Accepted
time: 2ms
memory: 3604kb
input:
6 693096423 325855803 397734150 452913860 865212556 401882541 359839198 273704952 91769372 452556215 624796499 94676229 583912695 487735025 28081785 637340461 395441577 158428084 642015149 378677143 997015016 112613899 25924573 416715404 938793867 841340446 645084716 584173615 339369731 268167946 96...
output:
26667017
result:
ok 1 number(s): "26667017"
Test #11:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
6 497339988 132152896 654380678 193992642 965772718 193749056 805861253 274203048 940603364 160636809 220303327 855232111 317732076 485901150 682620797 8603026 972203980 458638331 619763404 922792272 824811980 686287466 920409740 767753434 621971690 132318815 403410748 212880483 90557411 162430128 7...
output:
416264655
result:
ok 1 number(s): "416264655"
Test #12:
score: 0
Accepted
time: 2ms
memory: 3572kb
input:
7 579740785 54525994 44834293 878657882 279631262 403247951 729717507 131306386 756177373 734332304 470118837 22761079 787733766 106733389 273765421 587865055 628197653 773045283 49335196 725981923 537126441 176457057 381422736 849399808 491718724 943090791 593030874 416528970 756909575 679894728 50...
output:
106990924
result:
ok 1 number(s): "106990924"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
7 499019728 600058228 661404162 493358713 449975138 977573964 747226687 805322268 777456453 422219910 511078279 204194675 422632243 321076081 529467847 546646299 714701441 815079375 699788190 553278422 551026913 473372770 400400619 761905830 907445609 515908862 494841524 770114706 129735324 91856745...
output:
842923075
result:
ok 1 number(s): "842923075"
Test #14:
score: 0
Accepted
time: 2ms
memory: 3592kb
input:
8 326989664 922591675 691934445 49908184 694049978 855152399 804628556 243401530 715552625 876712910 749803917 950845939 991554837 430764503 929514545 833356909 311492758 953299741 456655252 933891220 511600607 379695696 736920900 732623240 889071813 749873876 246009772 248884325 330021189 247193279...
output:
702912588
result:
ok 1 number(s): "702912588"
Test #15:
score: 0
Accepted
time: 2ms
memory: 3524kb
input:
8 350947633 236163705 5109206 42303203 37927573 613621796 354417345 816607409 620913134 608888998 66295049 821341940 889733581 488376886 936240010 997748197 547994912 432276405 834560303 630258847 663155552 874901021 786672992 657893382 279626886 301621979 550513322 22475066 980035003 266896630 4778...
output:
10588237
result:
ok 1 number(s): "10588237"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
9 918666774 790657347 183462810 770619466 264040462 856517809 879539605 101002964 84993356 158488989 890093514 739535307 195375899 205334646 724659143 939453281 839216094 272949671 863975308 986228740 51712032 738506114 92419054 165307635 736963930 7195990 38384151 81239680 747561034 814491838 75291...
output:
212733475
result:
ok 1 number(s): "212733475"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
9 102610379 489156762 147757784 371864118 307115484 975914779 210534451 511471473 602625722 889191252 390568394 14478643 776487898 299322351 148182879 917063137 951976620 104642593 354771714 491543041 629897338 309752689 888661757 764662054 341158621 12361827 690921264 21272888 649138392 677897457 6...
output:
555767972
result:
ok 1 number(s): "555767972"
Test #18:
score: 0
Accepted
time: 3ms
memory: 3560kb
input:
10 910338658 157220005 395357368 774852428 725382734 556256501 430176034 497254963 334873473 927691193 651630911 595041235 901034883 932887310 756074698 775693930 634634748 126701355 259898811 639776320 124895202 702122054 200878504 186834714 149417647 163107241 593759775 509566629 503913319 1258063...
output:
253606553
result:
ok 1 number(s): "253606553"
Test #19:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
10 939049098 106213167 181697016 647650039 522627881 761937379 188100971 785561747 260074874 175733262 540523560 285301810 637875870 265258820 651392433 220934833 167360755 202354541 436102116 76092329 240288428 418111693 599980810 257230387 232589622 852878229 992001668 315348061 65681988 230080766...
output:
647762668
result:
ok 1 number(s): "647762668"
Test #20:
score: 0
Accepted
time: 5ms
memory: 3772kb
input:
11 502015759 25285677 42457511 790530961 434768700 557621911 505087083 199284619 704314213 914500021 791920508 523126086 555394983 256918415 411823814 21185775 867390824 741318555 667218867 987081100 509434857 610393434 261409407 619519118 997309774 264857586 836673193 636889244 77024932 693104894 6...
output:
0
result:
ok 1 number(s): "0"
Test #21:
score: 0
Accepted
time: 6ms
memory: 3756kb
input:
11 444304552 381302693 700461441 662393295 206816573 354568538 459018346 901062606 852878016 874364312 243744650 45360536 958264228 177166382 538585040 719583861 674894779 294455112 12552392 467354524 565149886 921023038 118817740 687444649 50254415 90939939 209357259 430010142 949638244 275071149 6...
output:
135224746
result:
ok 1 number(s): "135224746"
Test #22:
score: 0
Accepted
time: 15ms
memory: 3524kb
input:
12 249264638 893351359 533985885 666814012 4759184 714559099 874965392 311379764 663689465 646815139 776638328 311815454 759216054 31488558 362540189 971710378 550685929 921573012 369506174 194990388 483909024 969203851 616907571 347170772 689630114 227212449 489652091 174277339 494564777 260403445 ...
output:
0
result:
ok 1 number(s): "0"
Test #23:
score: 0
Accepted
time: 12ms
memory: 3792kb
input:
12 581993301 237514946 679659793 418075826 618043340 177763340 555281194 269276027 605792724 804464208 564164868 995643056 567749936 347943562 265906560 380459876 582955516 951888219 854205548 928611638 127593050 884781084 265675692 953668709 237374294 982066628 711027395 413379804 546008148 1200413...
output:
286047763
result:
ok 1 number(s): "286047763"
Test #24:
score: 0
Accepted
time: 43ms
memory: 3828kb
input:
13 840941749 466449771 476053289 387525285 124210639 305859020 949876441 168981197 328097456 633623967 916927926 239900304 668069865 355519671 608223825 922234972 939013783 241222943 776826229 402899686 24020448 33047000 972405734 779855176 242554971 328962794 437598249 301599955 67676391 377162967 ...
output:
0
result:
ok 1 number(s): "0"
Test #25:
score: 0
Accepted
time: 42ms
memory: 3824kb
input:
13 739777686 752098493 390361939 715228756 228880002 776733818 781908115 950077777 255753813 596713297 629810330 512176892 38164988 526431158 396522510 333374726 469067630 139655825 911250788 428577635 258980196 771073929 566951813 494326025 865946423 234415273 433109420 67346504 37172701 470824509 ...
output:
295165811
result:
ok 1 number(s): "295165811"
Test #26:
score: 0
Accepted
time: 162ms
memory: 3688kb
input:
14 432618850 334515443 123153432 263808336 538629355 307224430 24787481 576043602 992505457 915400055 196612996 323556932 166858187 974518045 558940200 167726817 466737109 560872882 184146276 455237206 998494623 941318388 172332110 663078608 795479838 430713139 385544407 683416281 485216236 94446152...
output:
0
result:
ok 1 number(s): "0"
Test #27:
score: 0
Accepted
time: 160ms
memory: 3680kb
input:
14 293239131 320430108 769663988 600796428 20238921 597367710 202174918 771379051 452977470 830431096 642917362 11856636 742465551 277425276 868026548 812562361 485977912 730739008 889992135 714047376 579819860 120973260 601821334 648639570 365817529 581068278 127328140 710849703 863556498 65741837 ...
output:
145955388
result:
ok 1 number(s): "145955388"
Test #28:
score: 0
Accepted
time: 561ms
memory: 5828kb
input:
15 474834989 202581116 614681806 984519618 953048070 759128878 99698531 433645036 656913449 902208883 336902594 956674531 370679258 593516409 509656575 413218671 855064963 880522822 591466332 663146503 383034270 5161537 527830274 95763003 192832918 393068002 333490564 515771636 58327849 356188299 23...
output:
0
result:
ok 1 number(s): "0"
Test #29:
score: 0
Accepted
time: 560ms
memory: 3996kb
input:
15 825508642 448007000 445232137 702396422 291064468 773390789 263903591 497041998 348629809 947438936 532180867 904571242 560124660 852453601 313782241 980762837 991079572 357500612 404172687 192554343 352975396 964819596 894604882 233608577 501322089 117849998 125200095 786156644 886304281 2407035...
output:
906397078
result:
ok 1 number(s): "906397078"
Test #30:
score: -100
Time Limit Exceeded
input:
16 66512091 775679537 261781949 705230891 523038554 760494289 469576840 840707440 321321440 634524001 321620413 884759381 279533069 73119292 304801173 519315043 87821030 60777270 154358157 166023052 513080214 913432925 588361177 823414666 335692295 494818347 986469471 348126991 475867694 628519599 9...