Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 2038 | 2024-2025 ICPC, NERC, Southern and Volga Russian Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams) | FINISHED | False | 18000 | 44479523 | Nov. 18, 2024, 10:35 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 746 ) | I | Polyathlon | PROGRAMMING | data structures hashing string suffix structures strings | 2500 |
Berland is this year's host country of the International Collegiate Polyathlon Competition! Similar to biathlon being a competition of two sports, polyathlon is a competition of many sports. This year, there are (m) sports. Also, there are (n) participants in the event. The sports are numbered from (1) to (m), and the participants are numbered from (1) to (n). Some participants are skilled in multiple sports. You are given a binary matrix (n \times m) such that the (j)-th character of the (i)-th row is 1 if the (i)-th participant is skilled in the (j)-th sport, and 0 , otherwise. It's also known that, for each pair of participants, there exists at least one sport such that one of them is skilled in that sport and the other one isn't. The order of sports in the competition is determined at the opening ceremony. Historically, it's done by the almighty Random Number Generator. A random number (x) from (1) to (m) is rolled. The competition then starts with the sport (x), then the sport ((x \bmod m + 1)) is played, then the sport (((x + 1) \bmod m + 1)), and so on. Each sport is played as follows. If all remaining participants (all participants which are not eliminated yet) are not skilled in that sport, everyone goes through to the next sport. Otherwise, all skilled participants go through to the next sport, and all unskilled participants are eliminated from the competition. Once there is a single participant remaining in the competition, the competition ends, and that participant is declared the winner. As an organizer of the competition, you are curious of the possible outcomes of the competition beforehand (not that you are going to rig the random roll, how could you possibly think that...). For each sport (x), print the index of the winner if the competition starts with the sport (x). The first line contains two integers (n) and (m) ((2 \le n, m \le 10^6); $$$n \le 2^m$ |
No solutions yet.