Submission #1187047
Source Code Expand
#include<bits/stdc++.h> #include<bitset> #define N 305 #define LL long long using namespace std; const int mo=1e9+7; int n,m,f[N][N],pw[N*N],ans; bitset<N> c,p[N]; LL fpm(LL x,LL y){ LL s=1; while(y){ if(y&1) s=(s*x)%mo; y>>=1,x=(x*x)%mo;} return s;} int main() { int i,j,x; scanf("%d",&n); for(i=1;i<=n;i++){ for(j=1;j<=n;j++) scanf("%d",&x),c[j]=x; for(j=1;j<=n;j++){ if(c[j]==0) continue; if(p[j]==0){ p[j]=c,m++; break;} else c^=p[j]; } } pw[0]=1; for(i=1;i<=n*n;i++) pw[i]=(pw[i-1]*2)%mo; f[0][0]=1; for(i=0;i<=n;i++) for(j=0;j<=i;j++){ f[i+1][j+1]=(f[i+1][j+1]+1LL*(pw[n]-pw[j]+mo)*f[i][j])%mo; f[i+1][j]=(f[i+1][j]+1LL*pw[j]*f[i][j])%mo; } for(i=m;i<=n;i++) ans=(ans+1LL*f[n][i]*pw[n*(n-i)]%mo*f[i][m])%mo; ans=1LL*ans*fpm(f[n][m],mo-2)%mo; cout<<ans; return 0; }
Submission Info
Submission Time | |
---|---|
Task | H - AB=C Problem |
User | MemorySlices |
Language | C++14 (GCC 5.4.1) |
Score | 1500 |
Code Size | 858 Byte |
Status | AC |
Exec Time | 9 ms |
Memory | 1024 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:13:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:16:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&x),c[j]=x; ^
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 | 1 ms | 256 KB |
001.txt | AC | 1 ms | 256 KB |
002.txt | AC | 1 ms | 256 KB |
003.txt | AC | 1 ms | 256 KB |
004.txt | AC | 1 ms | 256 KB |
005.txt | AC | 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 | AC | 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 | 512 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 | 1024 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 | AC | 9 ms | 1024 KB |
035.txt | AC | 6 ms | 768 KB |
036.txt | AC | 9 ms | 1024 KB |
037.txt | AC | 8 ms | 896 KB |
038.txt | AC | 9 ms | 896 KB |
039.txt | AC | 9 ms | 1024 KB |
example0.txt | AC | 1 ms | 256 KB |
example1.txt | AC | 1 ms | 256 KB |