# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
20042 |
2016-02-25T08:50:23 Z |
Namnamseo |
흑백 (kriii4_G) |
C++14 |
|
847 ms |
1084 KB |
#include <cstdio>
int map[5][5];
typedef long long ll;
ll ans;
const int M=int(1e9)+7;
ll pow(ll a,ll b){
if(b==0) return 1;
ll ret=pow(a,b/2);
ret=(ret*ret)%M;
if(b&1) ret=(ret*a)%M;
return ret;
}
int main()
{
int n,m;
scanf("%d%d",&n,&m);
if(n>5) n=4; if(m>5) m=4;
int allm = 1<<(n*m);
int nm=1<<n, mm=1<<m;
int s;
int a,b;
for(s=0;s<allm;++s){
int i,j;
for(i=0;i<n; ++i){
for(j=0;j<m;++j){
map[i][j]=1&(s>>(i*m+j));
}
}
int a1=0, a2=0;
for(i=1;i<nm;++i){
for(j=1;j<mm;++j){
int oc, zc;
zc=oc=0;
for(a=0; a<n; ++a) if(1&(i>>a))
for(b=0; b<m; ++b) if(1&(j>>b)){
if(map[a][b]==1) ++oc;
else ++zc;
}
if(zc==0) ++a1;
if(oc==0) ++a2;
}
}
ans += a1*1LL*a2;
}
printf("%d\n",int(ans*pow(1<<(n*m),M-2)%M));
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |
9 |
Correct |
0 ms |
1084 KB |
Output is correct |
10 |
Correct |
0 ms |
1084 KB |
Output is correct |
11 |
Correct |
1 ms |
1084 KB |
Output is correct |
12 |
Correct |
16 ms |
1084 KB |
Output is correct |
13 |
Correct |
0 ms |
1084 KB |
Output is correct |
14 |
Correct |
0 ms |
1084 KB |
Output is correct |
15 |
Correct |
19 ms |
1084 KB |
Output is correct |
16 |
Correct |
846 ms |
1084 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
847 ms |
1084 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |