Skip to content

Commit 75b65d2

Browse files
committed
Toy Cars
1 parent 2ce3a28 commit 75b65d2

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

545A.cpp

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int main(){
5+
ios_base::sync_with_stdio(false);
6+
cin.tie(NULL);
7+
8+
int n;
9+
cin>>n;
10+
11+
int arr[n][n];
12+
13+
map<int, bool> mp;
14+
15+
for(int i = 0; i< n; i++){
16+
for(int j = 0; j< n; j++){
17+
cin>>arr[i][j];
18+
}
19+
}
20+
21+
for(int i = 0; i < n; i++){
22+
for(int j = i+1; j < n; j++){
23+
if(arr[i][j] == 1){
24+
mp[i] = true;
25+
continue;
26+
}
27+
if(arr[i][j] == 2){
28+
mp[j] = true;
29+
continue;
30+
}
31+
if(arr[i][j] == 3){
32+
mp[i] = mp[j] = true;
33+
}
34+
35+
}
36+
}
37+
38+
int arrb[n], k = 0;
39+
for(int i = 0; i < n; i++){
40+
if(!mp[i]){
41+
arrb[k] = i + 1;
42+
k++;
43+
}
44+
}
45+
cout<<k<<'\n';
46+
for(int i = 0; i < k; i++){
47+
cout<<arrb[i]<<" ";
48+
}
49+
}

0 commit comments

Comments
 (0)