이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |