390A. Inna and Alarm Clock

来源:互联网 发布:淘宝店铺导航条制作 编辑:程序博客网 时间:2024/05/22 01:36

一道水题。。结果自己没注意范围。。。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;};


0 0
原创粉丝点击