#936
Gold I
LUBENICA
시간 제한
1s
메모리 제한
64MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Children in school are having fun instead of listening to the teacher. With their iPhone devices the children throw watermelons at each other on the Facebook social site. The game started when Goran threw one watermelon at each of his friends during the first class that day. During subsequent classes, all children (including Goran) behaved like this:

  • If they had been hit by an odd number of watermelons during the previous class, they threw

exactly one watermelon at each of their friends;

  • If they had been hit by an even number of watermelons (including zero), then they hit each of

their friends with two watermelons. The children are numbered 1 through N, Goran obviously being number 1. The friend relationships between the children are also known. Write a program that will calculate the total number of watermelons thrown after H classes.

입력

The first line contains two integers N and H (1 ≤ N ≤ 20, 1 ≤ H ≤ 1 000 000 000), the number of kids and classes. Each of the following N lines contains a string of N characters '0' or '1'. The character (A, B) in this matrix is '1' if children A and B are friends. No child will be their own friend. The input matrix will be symmetric.

출력

Output the number of watermelons after H classes.

예제 입력 1

4 1
0110
1001
1001
0110

예제 출력 1

2

예제 입력 2

4 2
0110
1001
1001
0110

예제 출력 2

14

예제 입력 3

5 3
01000
10110
01000
01001
00010

예제 출력 3

26
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Gold I1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.