STANAANDREY

pb 2/15/2021

Feb 15th, 2021 (edited)
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. #define NMAX 103
  4. int n, m;
  5. int inc[NMAX][NMAX], d[NMAX][2];
  6.  
  7. void read() {
  8.     cin >> n >> m;
  9.     for (int i = 1; i <= n; i++) {
  10.         for (int j = 1; j <= m; j++) {
  11.             cin >> inc[i][j];
  12.         }
  13.     }
  14. }
  15.  
  16. void solve() {
  17.     for (int j = 1; j <= n; j++) {
  18.         for (int i = 1; i <= m; i++) {
  19.             if (inc[i][j] == 1) {
  20.                 d[i][0]++;
  21.             }
  22.             if (inc[i][j] == -1) {
  23.                 d[i][1]++;
  24.             }
  25.         }
  26.     }
  27. }
  28.  
  29. void write() {
  30.     cout << "1: ";
  31.     for (int j = 1; j <= n; j++) {
  32.         if (!d[j][1] && !d[j][0]) {
  33.             cout << j << ' ';
  34.         }
  35.     }
  36.     cout << endl << "2: ";
  37.     for (int j = 1; j <= n; j++) {
  38.         if (d[j][1] > d[j][0]) {
  39.             cout << j << ' ';
  40.         }
  41.     }
  42. }
  43.  
  44. int main() {
  45.     read();
  46.     solve();
  47.     write();
  48.     return 0;
  49. }
  50.  
Add Comment
Please, Sign In to add comment