fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8. int n,m,i,j,count;
  9. cin>>n>>m;
  10. int arr[m],brr[n][m];
  11. char ch;
  12. for(i=0;i<m;i++)
  13. arr[i]=-1;
  14. for(i=0;i<n;i++)
  15. {
  16. for(j=0;j<m;j++)
  17. {
  18. cin>>ch;
  19. brr[i][j]=ch-'0';
  20. if(arr[j]<brr[i][j])
  21. arr[j]=brr[i][j];
  22. }
  23. }
  24. count=0;
  25. for(i=0;i<n;i++)
  26. {
  27. for(j=0;j<m;j++)
  28. {
  29. if(arr[j]<=brr[i][j])
  30. {count++;break;}
  31. }
  32. }
  33. cout<<count;
  34. return 0;
  35. }
Success #stdin #stdout 0s 16048KB
stdin
3 3
223
232
112
stdout
2