QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87454#5748. Determinant, or...?SvyatAC ✓100ms7156kbC++171.3kb2023-03-13 07:52:152023-03-13 07:52:18

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-13 07:52:18]
  • 评测
  • 测评结果:AC
  • 用时:100ms
  • 内存:7156kb
  • [2023-03-13 07:52:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

class Int {
private:
	static const int MOD = 1e9 + 9;
	int x;
public:
	Int(int _x = 0) : x(_x) {
		x %= MOD;
		if (x < 0) x += MOD;
	}
	Int(const Int &p) {
		x = p.x;
	}
	Int operator+(Int p) {
		return Int(x + p.x);
	}
	Int operator-(Int p) {
		return Int(x - p.x);
	}
	Int operator*(const Int &p) const {
		return Int(x * 1LL * p.x % MOD);  
	}
	void operator+=(Int p) {
		*this = *this + p;
	}
	void operator*=(Int p) {
		*this = *this * p;
	}
	void operator-=(Int p) {
		*this = *this - p;
	}
	bool operator==(Int p) {
		return x == p.x;
	}
	friend istream &operator>>(istream &in, Int &p) {
		int x;
		in >> x;
		p = x;
		return in;
	}
	friend ostream &operator<<(ostream &out, Int p) {
		out << p.x;
		return out;
	}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<Int> a(1 << n);
	for (int i = 0; i < (1 << n); ++i) {
		cin >> a[i];
	}
	for (int i = n - 1; i >= 0; --i) {
		for (int x = 0; x < (1 << n); x += 2 << i) {
			for (int j = 0; j < (1 << i); ++j) {
				a[x + j] -= a[x + j + (1 << i)];
			}
		}
	}
	Int res = accumulate(a.begin(), a.end(), Int(1), [](const Int &a, const Int &b) { return a * b; });
	cout << res << '\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

input:

1
5 2

output:

6

result:

ok 1 number(s): "6"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3400kb

input:

2
3 1 5 4

output:

999999997

result:

ok 1 number(s): "999999997"

Test #3:

score: 0
Accepted
time: 2ms
memory: 3356kb

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: 3356kb

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: 3360kb

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: 3436kb

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: 1ms
memory: 3336kb

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: 2ms
memory: 3332kb

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: 0ms
memory: 3356kb

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: 3352kb

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: 1ms
memory: 3372kb

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: 3368kb

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: 1ms
memory: 3368kb

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: 0ms
memory: 3372kb

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: 1ms
memory: 3424kb

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: 2ms
memory: 3340kb

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: 2ms
memory: 3352kb

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: 2ms
memory: 3436kb

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: 2ms
memory: 3404kb

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: 2ms
memory: 3372kb

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: 2ms
memory: 3364kb

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: 2ms
memory: 3452kb

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: 1ms
memory: 3404kb

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: 3ms
memory: 3428kb

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: 2ms
memory: 3396kb

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: 0ms
memory: 3452kb

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: 4ms
memory: 3424kb

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: 5ms
memory: 3364kb

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: 5ms
memory: 3352kb

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: 0
Accepted
time: 9ms
memory: 3404kb

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...

output:

0

result:

ok 1 number(s): "0"

Test #31:

score: 0
Accepted
time: 9ms
memory: 3320kb

input:

16
873361177 217209881 501438569 910845666 290526879 102136675 939389273 365182189 669087240 991718355 292587734 994244650 376085623 357604835 791223346 985444366 775042784 53356034 830485511 964110028 679497855 316589152 551652178 954282879 110776398 99513006 9847996 245004518 343796553 241346180 6...

output:

875509564

result:

ok 1 number(s): "875509564"

Test #32:

score: 0
Accepted
time: 10ms
memory: 3452kb

input:

17
813760979 643745209 203849353 581513942 232424520 56826950 249520629 403341614 985729441 621332829 461910011 673448749 778321400 692117666 550484808 469839637 771116143 675394470 561678212 218360571 897619870 977276082 943859341 256099061 888617162 301601432 229382880 180482347 343946568 40246371...

output:

0

result:

ok 1 number(s): "0"

Test #33:

score: 0
Accepted
time: 8ms
memory: 3460kb

input:

17
292689969 222165222 376113500 82149144 688493714 414338821 948689745 779050881 405087543 419769238 197523978 749465503 18008187 846994428 731201087 958416263 152280558 566429330 591630425 784071942 365202344 824710833 311574314 561293463 433929486 929216612 634063848 165620893 544248901 993634747...

output:

605727107

result:

ok 1 number(s): "605727107"

Test #34:

score: 0
Accepted
time: 17ms
memory: 4068kb

input:

18
405438081 667382660 695377727 302225215 646843236 213764138 774970716 810404019 650137433 903108917 446627831 306566339 982142471 311116030 501201183 715331491 3872210 700077149 968998268 426269869 27665805 631053751 299357495 278717975 285970241 558923555 21757260 717870451 466519152 607544931 1...

output:

0

result:

ok 1 number(s): "0"

Test #35:

score: 0
Accepted
time: 17ms
memory: 3896kb

input:

18
642782239 576236457 466554746 550781788 333216318 635032619 286674637 981422905 77096069 752389939 258897042 619792262 225958978 875811675 572010934 808962805 961810670 770510598 275838778 943539318 557782177 664872517 418735525 7910010 364611778 689455525 52844980 186796217 414273317 659203447 9...

output:

841790187

result:

ok 1 number(s): "841790187"

Test #36:

score: 0
Accepted
time: 49ms
memory: 5092kb

input:

19
152686960 535448332 342477870 178508266 766294691 510096808 849881765 668005452 314545424 184884996 586917428 390222968 480930793 635147144 156950299 665856085 687167324 175298858 376318315 634179166 412205461 539325130 359888399 711402379 133862359 365706640 674736166 689621288 39630766 19271703...

output:

0

result:

ok 1 number(s): "0"

Test #37:

score: 0
Accepted
time: 53ms
memory: 5116kb

input:

19
713760251 197210689 709355202 448708346 980043773 24540520 284449348 249974630 721348893 696036118 529892373 862841971 925581675 76772593 843845398 39608953 383371035 877320952 926241411 725986364 212080666 739438622 939032699 607411904 568940744 298161279 643665447 96271053 424222564 823628803 7...

output:

971602711

result:

ok 1 number(s): "971602711"

Test #38:

score: 0
Accepted
time: 96ms
memory: 7156kb

input:

20
777005429 93616963 215172682 979175515 903505339 539887527 893557695 474765276 416921345 60539059 114375957 204449276 651301500 654937877 752913424 563992637 276276835 160133884 239924891 769773764 779938012 709328587 187281594 36177824 536018530 304538497 510238186 383325995 962600473 700496787 ...

output:

0

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 100ms
memory: 7060kb

input:

20
40846299 701672039 959661993 706841144 416840913 89258629 510886445 321030512 743495441 595878682 807222147 859658052 824844562 105860828 348975688 860248184 483636438 330108126 646836204 393206809 434898904 247896332 463043494 225394503 750920740 447311293 841192400 945134138 532501646 543925351...

output:

616416803

result:

ok 1 number(s): "616416803"

Test #40:

score: 0
Accepted
time: 2ms
memory: 3356kb

input:

1
0 1000000008

output:

1000000008

result:

ok 1 number(s): "1000000008"