//愚直解(高速) #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma warning(disable: 4996) #include int main(void) { int N, K; scanf("%d", &N); scanf("%d", &K); int A[10000][10]; for (int i = 0; i < N; ++i) { for (int j = 0; j < K; ++j) { scanf("%d", &A[i][j]); } } int sell[10000] = { 0 }; for (int i = 0; i < N - 1; ++i) { for (int j = i + 1; j < N; ++j) { int flag = 1; for (int k = 0; k < K; ++k) { if (A[i][k] <= A[j][k]) { continue; } flag = 0; } if (flag == 1) { sell[i] = 1; continue; } flag = 1; for (int k = 0; k < K; ++k) { if (A[j][k] <= A[i][k]) { continue; } flag = 0; } if (flag == 1) { sell[j] = 1; } } } int ans = 0; for (int i = 0; i < N; ++i) { ans += sell[i]; } printf("%d\n", ans); return 0; }