Advertisement
OMEGAHEAD_MonkoX

GYM - 5

Nov 1st, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. using namespace std;
  5. ostream & operator<<(ostream & out, vector<long long int> const & v)
  6. {
  7.     for (int el:v)
  8.         out<<el<<" ";
  9.     return out;
  10. }
  11.  
  12. int main()
  13. {
  14.     long long int n,i,j,m,ma,c;
  15.     cin >> n >> m;
  16.     vector < vector<long long int>> a(n, vector<long long int>(m));
  17.     vector<long long int> k;
  18.     ma=0;
  19.     c=0;
  20.     for (i=0;i<n;++i)
  21.         for(j=0;j<m;++j){
  22.             cin >> a[i][j];
  23.             if (a[i][j]>ma)
  24.                 ma=a[i][j];
  25.         }
  26.     for (i=0;i<n;++i){
  27.         for (j=0;j<m;++j)
  28.         {
  29.             if (a[i][j]==ma)
  30.             {
  31.                 ++c;
  32.                 k.push_back(i);
  33.                 break;
  34.             }
  35.         }
  36.     }
  37.     cout<<c<<endl;
  38.     cout<<k;
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement