# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
18992 | | kriii | 흑백 (kriii4_G) | C++14 | | 21 ms | 1084 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
const long long mod = 1000000007;
int h,w,v[10][10];
int bc[32],o[32];
int main()
{
for (int i=1;i<32;i++){
int x = i & (-i);
bc[i] = bc[i-x] + 1;
}
scanf ("%d %d",&h,&w);
long long sum = 0;
for (int b=0;b<(1<<(h*w));b++){
for (int i=0;i<h;i++) for (int j=0;j<w;j++) v[i][j] = (b & (1 << (i * w + j))) > 0;
long long cnt[2] = {0,};
for (int k=0;k<2;k++){
o[0] = (1 << w) - 1;
for (int i=0;i<h;i++){
o[1<<i] = 0;
for (int j=0;j<w;j++) if (v[i][j] == k){
o[1<<i] += 1<<j;
}
}
for (int i=1;i<(1<<h);i++){
int x = i & (-i);
if (i != x){
o[i] = o[i-x] & o[x];
}
cnt[k] += (1 << bc[o[i]]) - 1;
}
}
sum += cnt[0] * cnt[1];
sum %= mod;
}
for (int i=0;i<h*w;i++) sum = sum * 500000004 % mod;
printf ("%lld\n",sum);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |