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 |
|---|---|---|---|---|---|---|
| 860 | Codeforces Round 434 (Div. 1, based on Technocup 2018 Elimination Round 1) | FINISHED | False | 8400 | 270752123 | Sept. 17, 2017, 1:05 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 504 ) | E | Arkady and a Nobody-men | PROGRAMMING | data structures dfs and similar trees | 2600 |
Arkady words in a large company. There are n employees working in a system of a strict hierarchy. Namely, each employee, with an exception of the CEO, has exactly one immediate manager. The CEO is a manager (through a chain of immediate managers) of all employees. Each employee has an integer rank. The CEO has rank equal to 1 , each other employee has rank equal to the rank of his immediate manager plus 1 . Arkady has a good post in the company, however, he feels that he is nobody in the company's structure, and there are a lot of people who can replace him. He introduced the value of replaceability . Consider an employee a and an employee b , the latter being manager of a (not necessarily immediate). Then the replaceability r ( a , b ) of a with respect to b is the number of subordinates (not necessarily immediate) of the manager b , whose rank is not greater than the rank of a . Apart from replaceability, Arkady introduced the value of negligibility . The negligibility z a of employee a equals the sum of his replaceabilities with respect to all his managers, i.e. , where the sum is taken over all his managers b . Arkady is interested not only in negligibility of himself, but also in negligibility of all employees in the company. Find the negligibility of each employee for Arkady. The first line contains single integer n ( 1 ≤ n ≤ 5·10 5 ) — the number of employees in the company. The second line contains n integers p 1 , p 2 , ..., p n ( 0 ≤ p i ≤ n ), where p i = 0 if the i -th employee is the CEO, otherwise p i equals the id of the immediate manager of the employee with id i . The employees are numbered from 1 to n . It is guaranteed that there is exactly one 0 among these values, and also that the CEO is a manager (not necessarily immediate) for all the other employees. Print n integers — the negligibilities of all employees in the order of their ids: z 1 , z 2 , ..., z n . Consider the first example: The CEO has no managers, thus z 1 = 0 . r (2, 1) = |
| Codeforces Round 434 Div.1+Div.2 (and Technocup 2018 — Elimination Round 1) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 32201356 | xaku | E | Nov. 10, 2017, 5:05 p.m. | OK | GNU C++ | TESTS | 36 | 342 | 48230400 | 2600 | |
| 40979729 | ReaLNero1 | E | July 30, 2018, 5:13 p.m. | OK | GNU C++ | TESTS | 36 | 389 | 48230400 | 2600 | |
| 30569633 | 1919810 | E | Sept. 21, 2017, 7:52 a.m. | OK | GNU C++ | TESTS | 36 | 421 | 97996800 | 2600 | |
| 30541022 | shanquan2 | E | Sept. 20, 2017, 10:17 a.m. | OK | GNU C++ | TESTS | 36 | 467 | 74035200 | 2600 | |
| 34434635 | Scut82 | E | Jan. 22, 2018, 6:22 a.m. | OK | GNU C++ | TESTS | 36 | 498 | 34713600 | 2600 | |
| 34605636 | zx2017 | E | Jan. 27, 2018, 12:38 p.m. | OK | GNU C++ | TESTS | 36 | 560 | 118169600 | 2600 | |
| 31241272 | zyb | E | Oct. 12, 2017, 12:55 p.m. | OK | GNU C++ | TESTS | 36 | 561 | 83865600 | 2600 | |
| 31730025 | guille | E | Oct. 26, 2017, 6:26 a.m. | OK | GNU C++ | TESTS | 36 | 608 | 73830400 | 2600 | |
| 36787976 | saoyang | E | April 1, 2018, 4:36 a.m. | OK | GNU C++ | TESTS | 36 | 623 | 110387200 | 2600 | |
| 30533243 | vjudge1 | E | Sept. 20, 2017, 3:03 a.m. | OK | GNU C++ | TESTS | 36 | 748 | 84684800 | 2600 | |
| 30657181 | FizzyDavid | E | Sept. 24, 2017, 5:28 a.m. | OK | GNU C++11 | TESTS | 36 | 343 | 48230400 | 2600 | |
| 45785634 | Timely_Rain | E | Nov. 16, 2018, 1:05 a.m. | OK | GNU C++11 | TESTS | 36 | 389 | 72192000 | 2600 | |
| 58159607 | liqing | E | Aug. 2, 2019, 6:58 a.m. | OK | GNU C++11 | TESTS | 36 | 390 | 61030400 | 2600 | |
| 45981969 | moonzero | E | Nov. 20, 2018, 1:18 a.m. | OK | GNU C++11 | TESTS | 36 | 421 | 58163200 | 2600 | |
| 45785623 | Timely_Rain | E | Nov. 16, 2018, 1:04 a.m. | OK | GNU C++11 | TESTS | 36 | 436 | 72192000 | 2600 | |
| 55006141 | comld | E | June 3, 2019, 7:38 a.m. | OK | GNU C++11 | TESTS | 36 | 436 | 76083200 | 2600 | |
| 45785824 | lpa20020220 | E | Nov. 16, 2018, 1:25 a.m. | OK | GNU C++11 | TESTS | 36 | 451 | 62156800 | 2600 | |
| 59898185 | vjudge3 | E | Sept. 2, 2019, 12:49 p.m. | OK | GNU C++11 | TESTS | 36 | 451 | 92057600 | 2600 | |
| 59898789 | vjudge5 | E | Sept. 2, 2019, 1 p.m. | OK | GNU C++11 | TESTS | 36 | 452 | 80076800 | 2600 | |
| 51444698 | Chlience | E | March 18, 2019, 11:57 a.m. | OK | GNU C++11 | TESTS | 36 | 452 | 84070400 | 2600 | |
| 47863304 | jambow | E | Jan. 3, 2019, 7:53 a.m. | OK | GNU C++14 | TESTS | 36 | 592 | 62259200 | 2600 | |
| 34060878 | CQzhangyu | E | Jan. 10, 2018, 2:59 a.m. | OK | GNU C++14 | TESTS | 36 | 592 | 80486400 | 2600 | |
| 46955035 | quarteer | E | Dec. 13, 2018, 2:46 a.m. | OK | GNU C++14 | TESTS | 36 | 607 | 95129600 | 2600 | |
| 33998731 | _SHENZHEBEI_ | E | Jan. 8, 2018, 7:34 a.m. | OK | GNU C++14 | TESTS | 36 | 608 | 116531200 | 2600 | |
| 30455675 | FallDream | E | Sept. 18, 2017, 5:30 a.m. | OK | GNU C++14 | TESTS | 36 | 639 | 94310400 | 2600 | |
| 31162754 | Twishkle.Aevdark | E | Oct. 9, 2017, 8:48 a.m. | OK | GNU C++14 | TESTS | 36 | 639 | 154521600 | 2600 | |
| 47866113 | zhou888 | E | Jan. 3, 2019, 9:49 a.m. | OK | GNU C++14 | TESTS | 36 | 654 | 111923200 | 2600 | |
| 30454848 | KADR | E | Sept. 18, 2017, 4:22 a.m. | OK | GNU C++14 | TESTS | 36 | 655 | 52428800 | 2600 | |
| 47863711 | hyj542682306 | E | Jan. 3, 2019, 8:10 a.m. | OK | GNU C++14 | TESTS | 36 | 670 | 60518400 | 2600 | |
| 35918015 | CuriousCat.hzw | E | March 4, 2018, 11:26 a.m. | OK | GNU C++14 | TESTS | 36 | 686 | 102195200 | 2600 | |
| 52663648 | nickluo | E | April 13, 2019, 2:45 a.m. | OK | GNU C++17 | TESTS | 36 | 655 | 91443200 | 2600 | |
| 66639661 | justfocusplease | E | Dec. 11, 2019, 2:15 p.m. | OK | GNU C++17 | TESTS | 36 | 655 | 129228800 | 2600 | |
| 51599673 | Feeey | E | March 21, 2019, 2:22 a.m. | OK | GNU C++17 | TESTS | 36 | 701 | 164454400 | 2600 | |
| 46534237 | zhongyuwei | E | Dec. 3, 2018, 8 a.m. | OK | GNU C++17 | TESTS | 36 | 717 | 92364800 | 2600 | |
| 69859737 | AliShahali1382 | E | Jan. 30, 2020, 6:08 p.m. | OK | GNU C++17 | TESTS | 36 | 717 | 100352000 | 2600 | |
| 45122946 | Shayan.P | E | Oct. 31, 2018, 6:07 a.m. | OK | GNU C++17 | TESTS | 36 | 763 | 164864000 | 2600 | |
| 46354871 | JZmster | E | Nov. 29, 2018, 7:40 a.m. | OK | GNU C++17 | TESTS | 36 | 779 | 106393600 | 2600 | |
| 47862136 | HirasawaaYui | E | Jan. 3, 2019, 6:57 a.m. | OK | GNU C++17 | TESTS | 36 | 794 | 76800000 | 2600 | |
| 55094972 | Ari | E | June 4, 2019, 4:36 p.m. | OK | GNU C++17 | TESTS | 36 | 811 | 144486400 | 2600 | |
| 39851731 | Ali_Pi | E | July 1, 2018, 9:34 p.m. | OK | GNU C++17 | TESTS | 36 | 841 | 90521600 | 2600 | |
| 30449695 | Lewin | E | Sept. 17, 2017, 8:34 p.m. | OK | Java 8 | TESTS | 36 | 1060 | 106803200 | 2600 | |
| 30448895 | Lewin | E | Sept. 17, 2017, 8:03 p.m. | OK | Java 8 | TESTS | 36 | 1091 | 106803200 | 2600 | |
| 35800917 | tri | E | March 1, 2018, 3:21 a.m. | OK | Java 8 | TESTS | 36 | 1154 | 268390400 | 2600 | |
| 59893494 | vjudge4 | E | Sept. 2, 2019, 11:17 a.m. | OK | MS C++ | TESTS | 36 | 530 | 68608000 | 2600 | |
| 59892894 | vjudge4 | E | Sept. 2, 2019, 11:05 a.m. | OK | MS C++ | TESTS | 36 | 545 | 60518400 | 2600 |
Back to search problems