QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89036#5748. Determinant, or...?chiranko#ML 7ms19336kbC++14832b2023-03-18 14:12:552023-03-18 14:12:58

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-18 14:12:58]
  • 评测
  • 测评结果:ML
  • 用时:7ms
  • 内存:19336kb
  • [2023-03-18 14:12:55]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using LL = long long;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;	
	
	vector<LL> A((1 << n) * 2 + 1, 0), F((1 << n) * 2 + 1, 0);
	cin >> n;
	int mo = 1e9 + 9;
	for(int i = 0; i < (1 << n); ++i)
		cin >> F[i];
	
	for(int i = n - 1; i >= 0; --i){
		for(int mask = 0; mask < (1 << n); ++mask){
//			cerr << i << " " << mask << endl;
			if(!((mask >> i) & 1)){
//				cerr << (mask | (1 << i)) << " " << mask << " " << F[mask | (1 << i)] << " " << F[mask] << endl;
				F[mask] = (1LL * F[mask] - F[mask | (1 << i)] + mo) % mo;
//				cerr << F[mask] << endl;
				
			}
//			cerr << i << " " << mask << " " << F[mask] << endl;
		}
	}
	
	LL ans = 1;
	for(int i = 0; i < (1 << n); ++i)
		ans = F[i] * ans % mo;
	cout << ans;
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 7ms
memory: 19336kb

input:

1
5 2

output:

6

result:

ok 1 number(s): "6"

Test #2:

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

input:

2
3 1 5 4

output:

999999997

result:

ok 1 number(s): "999999997"

Test #3:

score: 0
Accepted
time: 3ms
memory: 11228kb

input:

3
53 37 42 42 84 37 66 8

output:

47229676

result:

ok 1 number(s): "47229676"

Test #4:

score: 0
Accepted
time: 0ms
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: 3336kb

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

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

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: -100
Memory Limit Exceeded

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:


result: