Submission #1151037
Source Code Expand
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
#include <string>
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define REP(i, x, y) for(int i = (int)x; i <= (int)y; i ++)
#define FOR(i, x, y) for(int i = (int)x; i < (int)y; i ++)
#define PER(i, x, y) for(int i = (int)x; i >= (int)y; i --)
#define trace(x) cerr << #x << " " << x << endl;
#define dprintf(...) fprintf(stderr, __VA__ARGS__)
#define dln() fprintf(stderr, "\n")
using namespace std;
typedef long long LL;
typedef long double db;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
const int N = 100005;
const int P = 1e9 + 7;
const int inf = 1e9;
const LL Inf = 1e15;
inline int IN(){
char ch = getchar(); int x = 0, f = 0;
while(ch < '0' || ch > '9') ch = getchar(), f = (ch == '-');
while(ch >= '0' && ch <= '9'){
x = (x << 1) + (x << 3) + ch - 48;
ch = getchar();
}
return f ? (-x) : x;
}
inline int Pow(int x, int y, int p){
int an = 1;
for(; y; y >>= 1, x = (LL)x * x % p) if(y & 1) an = (LL)an * x % p;
return an;
}
void renew(int &x, int y){
x += y;
if(x < 0) x += P;
else if(x >= P) x -= P;
}
template<typename T> inline void chkmin(T &a, const T &b) {if(a > b) a = b;}
template<typename T> inline void chkmax(T &a, const T &b) {if(a < b) a = b;}
bitset<305> now, bas[305];
int p2[305], dp[305][305], vis[305], n;
int main(){
scanf("%d", &n);
int rk = 0;
REP(i, 1, n){
now.reset();
REP(j, 1, n){
int x;
scanf("%d", &x);
now[j] = x;
}
PER(j, n, 1) if(now[j]){
if(!vis[j]){
vis[j] = 1;
bas[j] = now;
++rk;
break;
}else now ^= bas[j];
}
}
//printf("%d\n", rk);
dp[0][0] = 1;
p2[0] = 1;
REP(i, 1, n) p2[i] = (p2[i - 1] + p2[i - 1]) % P;
REP(i, 0, n)
REP(j, 0, i){
int val = dp[i][j];
dp[i + 1][j] = (dp[i + 1][j] + (LL)val * p2[j]) % P;
dp[i + 1][j + 1] = (dp[i + 1][j + 1] + (LL)val * (p2[n] + P - p2[j])) % P;
}
int ans = 0;
REP(i, rk, n)
ans = (ans + (LL)dp[n][i] * Pow(2, n * (n - i), P) % P * dp[i][rk]) % P;
ans = (LL)ans * Pow(dp[n][rk], P - 2, P) % P;
printf("%d\n", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
H - AB=C Problem |
User |
syc19999 |
Language |
C++14 (GCC 5.4.1) |
Score |
1500 |
Code Size |
2489 Byte |
Status |
AC |
Exec Time |
9 ms |
Memory |
640 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:68:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:74:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &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 |
384 KB |
015.txt |
AC |
2 ms |
384 KB |
016.txt |
AC |
2 ms |
384 KB |
017.txt |
AC |
5 ms |
512 KB |
018.txt |
AC |
2 ms |
384 KB |
019.txt |
AC |
1 ms |
256 KB |
020.txt |
AC |
3 ms |
384 KB |
021.txt |
AC |
8 ms |
640 KB |
022.txt |
AC |
2 ms |
384 KB |
023.txt |
AC |
8 ms |
640 KB |
024.txt |
AC |
9 ms |
640 KB |
025.txt |
AC |
9 ms |
640 KB |
026.txt |
AC |
9 ms |
640 KB |
027.txt |
AC |
9 ms |
640 KB |
028.txt |
AC |
8 ms |
640 KB |
029.txt |
AC |
9 ms |
640 KB |
030.txt |
AC |
9 ms |
640 KB |
031.txt |
AC |
9 ms |
640 KB |
032.txt |
AC |
8 ms |
640 KB |
033.txt |
AC |
9 ms |
640 KB |
034.txt |
AC |
8 ms |
640 KB |
035.txt |
AC |
5 ms |
512 KB |
036.txt |
AC |
9 ms |
640 KB |
037.txt |
AC |
8 ms |
640 KB |
038.txt |
AC |
8 ms |
640 KB |
039.txt |
AC |
9 ms |
640 KB |
example0.txt |
AC |
1 ms |
256 KB |
example1.txt |
AC |
1 ms |
256 KB |