您的位置:首页 > 其它

390A. Inna and Alarm Clock

2014-02-12 12:31 253 查看
一道水题。。结果自己没注意范围。。。WA一次。。RE2次。。CE1次- - 这尼玛。。。然后就果断GG了

在闹钟响的时候  可以将一条直线上的闹钟全关。线可以是横的或竖的,但是只能用一种模式。

所以记录在同一行 和同一列的情况各有多少。

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int const M = 10010;
int main(){
int n;
scanf("%d",&n);
int hashx[M],hashy[M];
memset(hashy,0,sizeof(hashx));
memset(hashx,0,sizeof(hashy));
for(int i = 0;i < n;i++){
int x,y;
scanf("%d%d",&x,&y);
hashx[x] = 1;
hashy[y] = 1;
}
int xx = 0,yy = 0;
for(int i = 0;i < 101;i++){
if(hashx[i]) xx++;
if(hashy[i]) yy++;
}
printf("%d\n",xx>yy?yy:xx);
return 0;
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: