Codeforce Round #228 Div2 A
→ Practice
You are registered for practice. You can solve problems unofficially. Results can be found in the contest status and in the bottom of standings.
1 #pragma comment(linker,"/STACK:102400000,102400000") 2 #include <cstdio> 3 #include <vector> 4 #include <cmath> 5 #include <stack> 6 #include <queue> 7 #include <cstring> 8 #include <iostream> 9 #include <algorithm> 10 using namespace std; 11 #define INF 0x7fffffff 12 #define maxn 105 13 int n, m ,t ,b, x, y, mi, k ,flag; 14 int a[maxn][maxn]; 15 int main(){ 16 cin >> n; 17 for (int i = 0; i < n; i++)scanf("%d%d", &x, &y), a[x][y] = 1; 18 x = y = 0; 19 for (int i = 0; i <= 100; i++){ 20 flag = 0; 21 for (int j = 0; j <= 100; j++){ 22 if (a[i][j]){ flag = 1; break; } 23 } 24 if (flag)x++; 25 } 26 for (int j = 0; j <= 100; j++){ 27 flag = 0; 28 for (int i = 0; i <= 100; i++){ 29 if (a[i][j]){ flag = 1; break; } 30 } 31 if (flag)y++; 32 } 33 printf("%d\n", min(x, y)); 34 return 0; 35 }




浙公网安备 33010602011771号