Submission #1127532


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

const int maxn = 305,mo = int(1e9) + 7;

bitset<maxn> a[maxn];
int f[maxn][maxn],pw[maxn * maxn],n;

int pow(int a,int b)
{
	int tmp = 1;
	for(;b;b >>= 1,a = a * 1ll * a % mo)
		if (b & 1) tmp = tmp * 1ll * a % mo;
	return tmp;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1;i <= n;i ++)
		for(int j = 1,v;j <= n;j ++)
			scanf("%d", &v),a[i][j] = v;
	int r = 0;
	for(int i = 1,j = 1;i <= n && j <= n;j ++)
	{
		for(int k = i;k <= n;k ++) if (a[k][j]) {swap(a[i],a[k]);break;}
		if (!a[i][j]) continue;
		++ r;
		for(int k = i + 1;k <= n;k ++) if (a[k][j]) a[k] ^= a[i];
		++ i;
	}
	pw[0] = 1;
	for(int i = 1;i <= n * n;i ++) pw[i] = pw[i - 1] * 2ll % mo;
	f[0][0] = 1;
	for(int i = 1;i <= n;i ++)
		for(int j = 1;j <= i;j ++)
			f[i][j] = (f[i - 1][j] * 1ll * pw[j] % mo + f[i - 1][j - 1] * 1ll * (pw[n] - pw[j - 1]) % mo) % mo;
	int ans = 0;
	for(int i = r;i <= n;i ++)
		ans = (ans + f[n][i] * 1ll * pw[n * (n - i)] % mo * f[i][r]) % mo;
	printf("%d\n", (ans * 1ll * pow(f[n][r],mo - 2) % mo + mo) % mo);
	return 0;
}

Submission Info

Submission Time
Task H - AB=C Problem
User philipsweng
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1115 Byte
Status WA
Exec Time 9 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:42:65: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=]
  printf("%d\n", (ans * 1ll * pow(f[n][r],mo - 2) % mo + mo) % mo);
                                                                 ^
./Main.cpp:20:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
./Main.cpp:23:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &v),a[i][j] = v;
                               ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1500
Status
AC × 2
AC × 36
WA × 6
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 WA 1 ms 256 KB
001.txt AC 1 ms 256 KB
002.txt WA 1 ms 256 KB
003.txt AC 1 ms 256 KB
004.txt AC 1 ms 256 KB
005.txt WA 1 ms 256 KB
006.txt AC 1 ms 256 KB
007.txt AC 1 ms 256 KB
008.txt AC 1 ms 256 KB
009.txt WA 1 ms 256 KB
010.txt AC 1 ms 256 KB
011.txt AC 1 ms 256 KB
012.txt AC 1 ms 256 KB
013.txt AC 1 ms 256 KB
014.txt AC 2 ms 384 KB
015.txt AC 3 ms 512 KB
016.txt AC 2 ms 384 KB
017.txt AC 5 ms 640 KB
018.txt AC 2 ms 384 KB
019.txt AC 1 ms 256 KB
020.txt AC 3 ms 512 KB
021.txt AC 9 ms 896 KB
022.txt AC 2 ms 384 KB
023.txt AC 9 ms 896 KB
024.txt AC 9 ms 1024 KB
025.txt AC 9 ms 1024 KB
026.txt AC 9 ms 1024 KB
027.txt AC 9 ms 1024 KB
028.txt AC 9 ms 1024 KB
029.txt AC 9 ms 1024 KB
030.txt AC 9 ms 1024 KB
031.txt AC 9 ms 1024 KB
032.txt AC 9 ms 1024 KB
033.txt AC 9 ms 1024 KB
034.txt WA 9 ms 1024 KB
035.txt WA 6 ms 768 KB
036.txt AC 9 ms 1024 KB
037.txt AC 8 ms 896 KB
038.txt AC 9 ms 1024 KB
039.txt AC 9 ms 896 KB
example0.txt AC 1 ms 256 KB
example1.txt AC 1 ms 256 KB