302810: CF545A. Toy Cars
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Toy Cars
题意翻译
### 题目 有n辆玩具车。两两对撞。碰撞的结果可能是下列之一:没有任何车翻车,有一辆车翻车,或是两辆车翻车。碰撞结果由一个n×n矩阵AAA确定:在第i行和第j列的交叉点上有一个数字,描述了第i辆车和第j辆车碰撞的结果: -1:如果这对车没有碰撞。 -1只出现在矩阵的对角线上。 0:碰撞过程中没有任何一辆车翻车。 1:只有第i辆车在碰撞中翻车。 2:只有J车在碰撞中翻车。 3:两辆车在碰撞过程中翻车。 苏西想知道有多少辆的没有翻的车。你能应付这项任务吗? ### 输入 第一行是一个整数n,接下来是一个n*n的矩阵 ### 输出 一个整数,所有没有翻的车的数量 接下来一行,表示没有翻的车的编号,两数之间用空格隔开 ### 数据范围 0<n<101,保证所有数据合法题目描述
Little Susie, thanks to her older brother, likes to play with cars. Today she decided to set up a tournament between them. The process of a tournament is described in the next paragraph. There are $ n $ toy cars. Each pair collides. The result of a collision can be one of the following: no car turned over, one car turned over, both cars turned over. A car is good if it turned over in no collision. The results of the collisions are determined by an $ n×n $ matrix $ А $ : there is a number on the intersection of the $ і $ -th row and $ j $ -th column that describes the result of the collision of the $ і $ -th and the $ j $ -th car: - $ -1 $ : if this pair of cars never collided. $ -1 $ occurs only on the main diagonal of the matrix. - $ 0 $ : if no car turned over during the collision. - $ 1 $ : if only the $ i $ -th car turned over during the collision. - $ 2 $ : if only the $ j $ -th car turned over during the collision. - $ 3 $ : if both cars turned over during the collision. Susie wants to find all the good cars. She quickly determined which cars are good. Can you cope with the task?输入输出格式
输入格式
The first line contains integer $ n $ ( $ 1<=n<=100 $ ) — the number of cars. Each of the next $ n $ lines contains $ n $ space-separated integers that determine matrix $ A $ . It is guaranteed that on the main diagonal there are $ -1 $ , and $ -1 $ doesn't appear anywhere else in the matrix. It is guaranteed that the input is correct, that is, if $ A_{ij}=1 $ , then $ A_{ji}=2 $ , if $ A_{ij}=3 $ , then $ A_{ji}=3 $ , and if $ A_{ij}=0 $ , then $ A_{ji}=0 $ .
输出格式
Print the number of good cars and in the next line print their space-separated indices in the increasing order.
输入输出样例
输入样例 #1
3
-1 0 0
0 -1 1
0 2 -1
输出样例 #1
2
1 3
输入样例 #2
4
-1 3 3 3
3 -1 3 3
3 3 -1 3
3 3 3 -1
输出样例 #2
0