Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
LSFIGHT - Đấu trường VM08 |
English | Vietnamese |
The VM08 arena
In this year Marathon '08, the vCoders have to play in a knock-out tournament. After the qualification round, the board of directors has selected N competitors of highest scores and numbered them from 1 to N. These competitors have to stand in order along a circle (so that the nth person is beside the first one). Then the board selects a random two ajdacent competitors to compete with each other. The loser is eliminated and has to go out of the circle. The tournament continues in this way until there is only one competitor left. This competitor will be the ultimate champion.
Knowing in advance the winners in all matches, help the board to determine who have chance to be the champion.
Input
- The first line: an integer N (3 ≤ N ≤ 500).
- In the next N lines there is a matrix A[i, j], in which A[i, j] = 0 if the ith competitor will lose over the jth competitor and A[i, j] = 1 if the ith competitor will win over the jth competitor. It is guaranteed that A[i, i] = 1 for all i and A[i, j] + A[j, i] = 1 for i <> j. The numbers are separated by at least one space.
Output
- The first line: a positive integer M - the number of competitors that have chance to be the champion.
- In each line in the next M lines, print M numbers that are the indexes of the competitors that have chance to be the champion. The indexes should be printed in ascending order.
Example
Input 7 1 1 1 1 1 0 1 0 1 0 1 1 0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 0 0 0 0 1 Output 3 1 3 6
Được gửi lên bởi: | Bare & Simple |
Ngày: | 2008-08-07 |
Thời gian chạy: | 0.100s-0.600s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | Tất cả ngoại trừ: ERL GOSU JS-RHINO NODEJS PERL6 PYPY RUST SED VB.NET |
Nguồn bài: | VNOI Marathon '08 - Round 9/DivB Problem Setter: Tô Quang Phúc Origin:POI6 |
hide comments
2021-05-27 18:01:52
Tham khảo: https://vnspoj.github.io/problems/LSFIGHT |
|
2019-08-13 10:00:26
1 dam AC |
|
2018-12-31 15:21:45
92 sai gi nhi? |
|
2017-12-23 10:52:12
code AC: https://ideone.com/Nymf4m |
|
2015-09-08 14:22:36
https://thewizard6296.wordpress.com/2015/09/04/5/ |
|
2015-06-14 15:55:41 Duc M. Pham
Tối ưu mãi vẫn bị TLE test cuối :'( 96 miết T.T Thôi chịu thua... |
|
2014-08-29 16:39:53 Thcs Ðặng Chánh Kỷ
Ac, sướng vãi, bài này qhd thôi, may mà vẫn ac được, thấy time chặt kung khỉnh |
|
2014-06-20 05:18:25 Lê Nhựt
mình đấu vs mình => 2 thằg đều là mình => ai thắg cũng là mình => mình thằng mình ^^ |
|
2013-09-23 14:11:35 a;slkfjasl;fkj
tại sao mình lại thắng mình |