Submission #1051212
Source Code Expand
#include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #include<vector> #include<set> #include<map> #include<bitset> #include<cmath> #include<string> #define ls (t<<1) #define rs ((t<<1)+1) #define mid ((l+r)>>1) #define fi first #define se second #define mk make_pair #define pb push_back #define N 305 #define M 200005 #define seed 23333 #define Mo 1000000007 using namespace std; int i,j,m,n,p,k,A[N][N],rk,f[N][N][N],pw2[N*N]; void jia(int &x,int y) { x+=y; if (x>=Mo) x-=Mo; } int jian(int x,int y) { x-=y; if (x<0) x+=Mo; return x; } int main() { scanf("%d",&n); pw2[0]=1; for (i=1;i<N*N;++i) pw2[i]=pw2[i-1]*2%Mo; for (i=1;i<=n;++i) { for (j=1;j<=n;++j) scanf("%d",&A[i][j]); } rk=0; for (i=1;i<=n;++i) { for (j=rk+1;j<=n;++j) if (A[i][j]) break; if (j>n) continue; ++rk; for (k=1;k<=n;++k) swap(A[k][rk],A[k][j]); for (j=rk+1;j<=n;++j) if (A[i][j]) for (k=1;k<=n;++k) A[k][j]^=A[k][rk]; } f[0][0][0]=1; for (i=0;i<n;++i) for (j=0;j<=min(i,rk);++j) for (k=0;k<=min(i-j,n-rk);++k) if (f[i][j][k]) { jia(f[i+1][j][k],1ll*f[i][j][k]*pw2[j+k]%Mo); if (j<rk) jia(f[i+1][j+1][k],1ll*f[i][j][k]*jian(pw2[rk+k],pw2[j+k])%Mo); if (k<n-rk) jia(f[i+1][j][k+1],1ll*f[i][j][k]*jian(pw2[n],pw2[rk+k])%Mo); } int ans=0; for (i=0;i<=n-rk;++i) jia(ans,1ll*f[n][rk][i]*pw2[n*(n-i-rk)]%Mo); printf("%d\n",ans); }
Submission Info
Submission Time | |
---|---|
Task | H - AB=C Problem |
User | qiaoranliqu |
Language | C++14 (GCC 5.4.1) |
Score | 1500 |
Code Size | 1526 Byte |
Status | AC |
Exec Time | 177 ms |
Memory | 55936 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:38:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:43:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for (j=1;j<=n;++j) scanf("%d",&A[i][j]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1500 / 1500 | ||||
Status |
|
|
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 | 4 ms | 640 KB |
001.txt | AC | 4 ms | 640 KB |
002.txt | AC | 4 ms | 640 KB |
003.txt | AC | 4 ms | 640 KB |
004.txt | AC | 4 ms | 640 KB |
005.txt | AC | 4 ms | 640 KB |
006.txt | AC | 4 ms | 640 KB |
007.txt | AC | 4 ms | 640 KB |
008.txt | AC | 4 ms | 640 KB |
009.txt | AC | 4 ms | 640 KB |
010.txt | AC | 4 ms | 640 KB |
011.txt | AC | 4 ms | 640 KB |
012.txt | AC | 4 ms | 640 KB |
013.txt | AC | 4 ms | 640 KB |
014.txt | AC | 23 ms | 8960 KB |
015.txt | AC | 17 ms | 4992 KB |
016.txt | AC | 10 ms | 3200 KB |
017.txt | AC | 11 ms | 2048 KB |
018.txt | AC | 7 ms | 1920 KB |
019.txt | AC | 4 ms | 768 KB |
020.txt | AC | 39 ms | 12800 KB |
021.txt | AC | 170 ms | 45568 KB |
022.txt | AC | 6 ms | 1408 KB |
023.txt | AC | 74 ms | 15744 KB |
024.txt | AC | 140 ms | 55808 KB |
025.txt | AC | 169 ms | 42752 KB |
026.txt | AC | 176 ms | 50304 KB |
027.txt | AC | 148 ms | 35072 KB |
028.txt | AC | 37 ms | 7168 KB |
029.txt | AC | 174 ms | 44928 KB |
030.txt | AC | 177 ms | 49024 KB |
031.txt | AC | 164 ms | 40320 KB |
032.txt | AC | 18 ms | 3072 KB |
033.txt | AC | 172 ms | 52864 KB |
034.txt | AC | 14 ms | 2304 KB |
035.txt | AC | 11 ms | 1920 KB |
036.txt | AC | 128 ms | 55936 KB |
037.txt | AC | 108 ms | 47872 KB |
038.txt | AC | 23 ms | 4096 KB |
039.txt | AC | 128 ms | 54144 KB |
example0.txt | AC | 4 ms | 640 KB |
example1.txt | AC | 4 ms | 768 KB |