Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- const int N = 105;
- int n;
- int a[N][N];
- vector <int> g[N];
- int main(){
- cin >> n;
- int cnt = 0;
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- cin >> a[i][j];
- if (a[i][j]) {
- g[i].push_back(j);
- }
- }
- }
- for (int i = 1; i <= n; i++) {
- cout << g[i].size() << " ";
- for (int j = 0; j < g[i].size(); j++) {
- cout << g[i][j] << " ";
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement