QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#799433#7193. Data Structure You've Never Heard Ofrlc202204WA 1ms3952kbC++14817b2024-12-05 14:00:502024-12-05 14:00:50

Judging History

This is the latest submission verdict.

  • [2024-12-05 14:00:50]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3952kb
  • [2024-12-05 14:00:50]
  • Submitted

answer

#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 2e5 + 5;
const int MS = (1 << 16) + 5; 
const int mod = 1e9 + 7;

int n, d;
int f[MS] = {0};
int g[MS] = {0};

int main() {
	scanf("%d%d", &n, &d);
	int mid = d / 2;
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		int a = 0;
		for (int j = 0, x; j < d; j++)
			scanf("%1d", &x), a = a * 2 + x;
		int sum = 1;
		int x = (a >> mid), y = (a & ((1 << mid) - 1));
		for (int S = 0; S < (1 << (d - mid)); S++)
			if ((S & x) == S)
				sum = (sum + f[(S << mid) + y]);
		ans = (ans + sum) % mod;
		for (int S = 0; S < (1 << mid); S++)	
			if ((S & y) == y) 
				f[(x << mid) + S] = (f[(x << mid) + S] + sum) % mod;
	}		
	cout << ans << endl;
	return 0;
}

 

詳細信息

Test #1:

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

input:

3 2
00
00
11

output:

7

result:

ok 1 number(s): "7"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

4 3
110
100
011
101

output:

5

result:

ok 1 number(s): "5"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

50 1
0
1
0
1
1
1
1
1
0
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
1
1
1
0
1
0
1
0
0

output:

362807295

result:

ok 1 number(s): "362807295"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

50 1
0
0
1
0
1
0
1
1
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
1
0
1
0
1
1
1
0
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
0
1
1
0

output:

120927736

result:

ok 1 number(s): "120927736"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

50 8
01000111
10010111
01101011
00000000
00011110
10001111
01110110
01000011
00001101
11111011
10110111
11110111
11001011
11110100
11000100
10001100
11010101
01010000
11101100
11110010
01000011
00000110
10111100
11100000
01010001
01010010
01001011
11011111
01111010
01010111
11101111
11010010
0100010...

output:

973

result:

ok 1 number(s): "973"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

50 8
00000000
00101111
00000000
01010001
10001000
00001000
00000100
01011110
10111111
00101010
00010100
10101111
10000001
01000000
11011111
11111111
11111111
00000100
11111110
10111111
00000000
10111111
11111110
00000000
10000000
11111111
11111111
11111111
11110111
00000010
11111011
11111111
1000000...

output:

585391

result:

ok 1 number(s): "585391"

Test #7:

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

input:

50 15
001010001110101
101100011001001
111110110110111
000100111110000
110100100110010
101000111101000
101011010101100
111001100110111
001111001000001
100000001101010
000100101010011
010111001000000
100101010111001
100010110011110
111001101100111
001100100110101
000111100100100
001010011001010
011101...

output:

58

result:

ok 1 number(s): "58"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3708kb

input:

50 15
111111111111111
001000000000010
000000000010100
100111011111111
011111111111111
100000001000000
001000010000000
000000000000001
000000000000000
000000000000000
000000010000000
010111111110111
000001000001001
000000000000001
111111111111011
101101101111011
111111111111111
000100010000000
000000...

output:

2695

result:

ok 1 number(s): "2695"

Test #9:

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

input:

50 16
0111001000111000
0011001011011111
0111110111100111
1100001111111010
0111111010100110
0101110101111000
1011100011001110
1000011000110111
1001000111000010
1011000010110111
0001010111010000
0010110001000111
0110001101100000
1111100010111101
1011110000100100
1100011111111111
0000101001111010
11101...

output:

55

result:

ok 1 number(s): "55"

Test #10:

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

input:

50 16
1101011111111111
1011101111111111
0100000000010010
1101110111111101
1101101111111111
1101111011111111
0001000000000010
1111111110111111
1111110001111011
1111111101111011
1011011111011101
1111001111010101
0111111011111111
1111111010111111
0010000001000000
0001010000100000
1111010010111111
00000...

output:

274

result:

ok 1 number(s): "274"

Test #11:

score: -100
Wrong Answer
time: 0ms
memory: 3860kb

input:

500 1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
0
1
1
0
1
0
0
0
1
0
1
1
1
1
1
0
1
1
0
0
1
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
1
1
1
1
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
0
1
1
1
0
0
1
1
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
1
0
0
1
1
...

output:

712629369

result:

wrong answer 1st numbers differ - expected: '189427812', found: '712629369'