Sunday, February 16, 2014

codeforces round #229 (Div.2) problem A - Inna and Alarm Clock solution

codeforces round #229 (Div.2) problem A - Inna and Alarm Clock :  http://codeforces.com/contest/390/problem/A

codeforces round #229 (Div.2) problem A - Inna and Alarm Clock solution : http://ideone.com/vGitjD

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main() {
int n, a[100005], b[100005], x, y, cntx, cnty;
scanf("%d", &n);
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
cntx=cnty=0;
for(int i=0; i<n; i++) {
scanf("%d%d", &x, &y);
if(a[x]==0) a[x]++, cntx++;
if(b[y]==0) b[y]++, cnty++;
}
if(cntx<cnty) printf("%d\n", cntx);
else printf("%d\n", cnty);
return 0;
}

No comments:

Post a Comment