Submission #20009616


Source Code Expand

Copy
#include<bits/stdc++.h>
#define PB emplace_back
#define MP make_pair
#define fi first
#define se second
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int N = 300, mod = 1e9 + 7;
template<typename T>
void read(T &x){
	int ch = getchar(); x = 0; bool f = false;
	for(;ch < '0' || ch > '9';ch = getchar());
	for(;ch >= '0' && ch <= '9';ch = getchar()) x = x * 10 + ch - '0';
	if(f) x = -x;
}
template<typename T>
bool chmax(T &a, const T &b){if(a < b) return a = b, 1; return 0;}
template<typename T>
bool chmin(T &a, const T &b){if(a > b) return a = b, 1; return 0;}
void qmo(int &x){x += x >> 31 & mod;}
int ksm(int a, int b){
	int res = 1;
	for(;b;b >>= 1, a = (LL)a * a % mod)
		if(b & 1) res = (LL)res * a % mod;
	return res;
}
int n, r, pw2[N], dp[N][N], ans; bool vis[N];
bitset<N> bas[N], tmp;
int main(){
	read(n);
	for(int i = 0;i < n;++ i){
		for(int j = 0, ch;j < n;++ j){
			do ch = getchar(); while(ch != '0' && ch != '1');
			tmp[j] = ch - '0';
		}
		for(int j = 0;j < n;++ j) if(tmp[j]){
			if(vis[j]) tmp ^= bas[j];
			else {vis[j] = true; bas[j] = tmp; ++ r; break;}
		}
	} pw2[0] = 1;
	for(int i = 1;i <= n;++ i) qmo(pw2[i] = pw2[i-1] * 2 - mod);
	dp[0][0] = 1;
	for(int i = 0;i < n;++ i)
		for(int j = 0;j <= i;++ j){
			dp[i+1][j] = (dp[i+1][j] + (LL)dp[i][j] * pw2[j]) % mod;
			dp[i+1][j+1] = (dp[i+1][j+1] + (LL)dp[i][j] * (pw2[n] - pw2[j] + mod)) % mod;
		}
	for(int i = r;i <= n;++ i) ans = (ans + (LL)dp[n][i] * dp[i][r] % mod * ksm(2, n*(n-i))) % mod;
	printf("%lld\n", (LL)ans * ksm(dp[n][r], mod-2) % mod);
}

Submission Info

Submission Time
Task H - AB=C Problem
User yyybbbb
Language C++ (GCC 9.2.1)
Score 0
Code Size 1616 Byte
Status RE
Exec Time 140 ms
Memory 4044 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1500
Status
AC × 2
AC × 30
RE × 12
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, 032.txt, 033.txt, 034.txt, 035.txt, 036.txt, 037.txt, 038.txt, 039.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt AC 6 ms 3564 KB
001.txt AC 2 ms 3756 KB
002.txt AC 2 ms 3456 KB
003.txt AC 2 ms 3784 KB
004.txt AC 2 ms 3704 KB
005.txt AC 2 ms 3680 KB
006.txt AC 2 ms 3704 KB
007.txt AC 2 ms 3768 KB
008.txt AC 2 ms 3516 KB
009.txt AC 2 ms 3612 KB
010.txt AC 2 ms 3744 KB
011.txt AC 2 ms 3588 KB
012.txt AC 3 ms 3576 KB
013.txt AC 3 ms 3520 KB
014.txt AC 2 ms 3708 KB
015.txt AC 2 ms 3732 KB
016.txt AC 3 ms 3784 KB
017.txt AC 4 ms 3944 KB
018.txt AC 2 ms 3648 KB
019.txt AC 2 ms 3780 KB
020.txt AC 4 ms 3952 KB
021.txt AC 4 ms 3960 KB
022.txt AC 2 ms 3856 KB
023.txt AC 5 ms 4044 KB
024.txt RE 140 ms 3552 KB
025.txt RE 113 ms 3456 KB
026.txt RE 112 ms 3612 KB
027.txt RE 113 ms 3556 KB
028.txt RE 111 ms 3676 KB
029.txt RE 114 ms 3624 KB
030.txt RE 112 ms 3572 KB
031.txt RE 112 ms 3440 KB
032.txt RE 113 ms 3496 KB
033.txt RE 112 ms 3548 KB
034.txt RE 110 ms 3548 KB
035.txt AC 4 ms 4024 KB
036.txt RE 114 ms 3552 KB
037.txt AC 11 ms 3944 KB
038.txt AC 5 ms 3996 KB
039.txt AC 6 ms 3932 KB
example0.txt AC 2 ms 3700 KB
example1.txt AC 3 ms 3712 KB