Logo
(追記) (追記ここまで)

3166번 - maraton 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB257633.333%

문제

N teams are participating in a football marathon. A total of K matches are to be played, one match at a time.

The first match is played between teams 1 and 2. After that match, the defeated team leaves the field while the winner stays and plays team 3. After that match, the winner again stays on the field and plays the team 4 etc.

After team N finishes playing its match, we start over with team 1, then team 2, and so on. If a team is supposed to enter the field, but it is already there (as the winner), or if it has just left the field (was defeated), the next team enters the field.

Because of the big differences between teams in the tournament, the results are very predictive, and for each two teams we know who will be the winner in a match between them.

Write a program that finds the total number of matches that each of the teams will play.

입력

The first line of input contains two integers N and K, 3 ≤ N ≤ 1000, 0 ≤ K ≤ 1014.

Each of the following N lines contains sequence of N integers representing the NxN matrix consisting only of zeros and ones.

If Aij is 1 in the matrix, then team i defeats team j every time they play and if Aij=0 then team j defeats team i (Aij ≠ Aji).

출력

The first and only line of output should contain N numbers – the ith number is the total number of matches that team i will play in the tournament.

Note: use the 64-bit signed integer type (int64 in Pascal, long long in C/C++).

제한

예제 입력 1

3 5
000
100
110

예제 출력 1

3 3 4

예제 입력 2

3 50000
000
100
110

예제 출력 2

25000 25001 49999

예제 입력 3

4 5
0110
0010
0000
1110

예제 출력 3

3 2 2 3

힌트

출처

Olympiad > Croatian Highschool Competitions in Informatics > 2006 > National Competition #1 - Seniors 3번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /