【AIM Tech Round 4 (Div. 2) B】Rectangles
【链接】http://codeforces.com/contest/844/problem/B
【题意】
也是道计数水题,没什么记录意义
【题解】
枚举每个点的位置在,然后往右往下 枚举和它一样颜色的在还是不在.
【错的次数】
0
【反思】
在这了写反思
【代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rs(x) scanf("%s",x)
#define oi(x) printf("%d",x)
#define ol(x) printf("%lld",x)
#define oc putchar(' ')
#define os(x) printf(x)
#define all(x) x.begin(),x.end()
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 50;
LL b[N+10];
int a[N+10][N+10],n,m;
int main(){
//Open();
//Close();
b[0] = 1;
rep1(i,1,N)
b[i] = b[i-1]*2;
ri(n),ri(m);
rep1(i,1,n)
rep1(j,1,m)
ri(a[i][j]);
LL ans = 0;
rep1(i,1,n)
rep1(j,1,m){
//��
int cnt = 0;
rep1(k,j+1,m)
if (a[i][k]==a[i][j]) cnt++;
ans = ans + b[cnt];
//��
cnt = 0;
rep1(k,i+1,n)
if (a[k][j]==a[i][j]) cnt++;
ans = ans + b[cnt];
ans --;
}
ol(ans);puts("");
return 0;
}

浙公网安备 33010602011771号