Advertisement
Pit_Anonim

P

Nov 25th, 2021
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int size;
  8.     cin>>size;
  9.     int matrix[size][size];
  10.  
  11.     for (int x = 0; x < size; x++)
  12.         for (int y = 0; y < size; y++) {
  13.             cin>>matrix[x][y];
  14.         }
  15.  
  16.     vector<int> ist, st;
  17.  
  18.     int g = 0;
  19.     int j = 0;
  20.     for (int x = 0; x < size; x++) {
  21.         for (int y = 0; y < size; y++) {
  22.             if (matrix[x][y]) {
  23.                 g++;
  24.             }
  25.         }
  26.  
  27.         for (int u = 0; u < size; u++) {
  28.             if (matrix[u][x]) {
  29.                 j++;
  30.             }
  31.         }
  32.  
  33.         if (g == 0) {
  34.             st.push_back(x+1);
  35.         }
  36.  
  37.         if (j == 0) {
  38.             ist.push_back(x+1);
  39.         }
  40.         g=0;
  41.         j=0;
  42.     }
  43.  
  44.     cout<<ist.size()<<endl;
  45.     for (int x = 0; x < ist.size(); x++) {
  46.         cout<<ist[x]<<endl;
  47.     }
  48.  
  49.     cout<<st.size()<<endl;
  50.     for (int x = 0; x < st.size(); x++) {
  51.         cout<<st[x]<<endl;
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement