Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // olymp_in
- //
- // Created by Kadir Kadyrov on 19.10.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <algorithm>
- #include <string>
- #include <cstdio>
- #include <queue>
- #include <map>
- #include <vector>
- #include <stack>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int a[n][n];
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++) {
- cin >> a[i][j];
- }
- }
- vector<int> stok, istok;
- for (int i = 0; i < n; i++) {
- bool isIstok = true, isStok = true;
- for (int j = 0; j < n; j++) {
- if(a[i][j] == 1)
- isIstok = false;
- if (a[j][i] == 1)
- isStok = false;
- }
- if(isIstok == true)
- istok.push_back(i);
- if(isStok == true)
- stok.push_back(i);
- }
- cout << stok.size() << ' ';
- for (int i = 0; i < stok.size(); i++) {
- cout << stok[i] + 1 << ' ';
- }
- cout << endl;
- cout << istok.size() << ' ';
- for (int i = 0; i < istok.size(); i++) {
- cout << istok[i] + 1 << ' ';
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement