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 |
|---|---|---|---|---|---|---|
| 643 | VK Cup 2016 - Round 3 | FINISHED | False | 10800 | 313858485 | May 7, 2016, 3:05 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 340 ) | D | Bearish Fanpages | PROGRAMMING | 2900 |
There is a social website with n fanpages, numbered 1 through n . There are also n companies, and the i -th company owns the i -th fanpage. Recently, the website created a feature called following. Each fanpage must choose exactly one other fanpage to follow. The website doesn’t allow a situation where i follows j and at the same time j follows i . Also, a fanpage can't follow itself. Let’s say that fanpage i follows some other fanpage j 0 . Also, let’s say that i is followed by k other fanpages j 1 , j 2 , ..., j k . Then, when people visit fanpage i they see ads from k + 2 distinct companies: i , j 0 , j 1 , ..., j k . Exactly t i people subscribe (like) the i -th fanpage, and each of them will click exactly one add. For each of k + 1 companies j 0 , j 1 , ..., j k , exactly people will click their ad. Remaining people will click an ad from company i (the owner of the fanpage). The total income of the company is equal to the number of people who click ads from this copmany. Limak and Radewoosh ask you for help. Initially, fanpage i follows fanpage f i . Your task is to handle q queries of three types: 1 i j — fanpage i follows fanpage j from now. It's guaranteed that i didn't follow j just before the query. Note an extra constraint for the number of queries of this type (below, in the Input section). 2 i — print the total income of the i -th company. 3 — print two integers: the smallest income of one company and the biggest income of one company. The first line of the input contains two integers n and q ( 3 ≤ n ≤ 100 000 , 1 ≤ q ≤ 100 000 ) — the number of fanpages and the number of queries, respectively. The second line contains n integers t 1 , t 2 , ..., t n ( 1 ≤ t i ≤ 10 12 ) where t i denotes the number of people subscribing the i -th fanpage. The third line contains n integers f 1 , f 2 , ..., f n ( 1 ≤ f i ≤ n ). Initially, fanpage i follows fanpage f i . Then, q lines follow. The i -th of them describes the i -th query. The first number in the l |
| VK Cup 2016 — Round 3 — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 26235172 | tlzmybm | D | April 9, 2017, 10:54 a.m. | OK | GNU C++ | TESTS | 67 | 202 | 24780800 | 2900 | |
| 26234364 | tlzmybm | D | April 9, 2017, 10:04 a.m. | OK | GNU C++ | TESTS | 67 | 217 | 24678400 | 2900 | |
| 40984847 | ReaLNero1 | D | July 30, 2018, 7:36 p.m. | OK | GNU C++ | TESTS | 67 | 218 | 22630400 | 2900 | |
| 26235114 | tlzmybm | D | April 9, 2017, 10:51 a.m. | OK | GNU C++ | TESTS | 67 | 296 | 24780800 | 2900 | |
| 26233992 | tlzmybm | D | April 9, 2017, 9:41 a.m. | OK | GNU C++ | TESTS | 67 | 327 | 39833600 | 2900 | |
| 25965944 | XuYipei | D | March 31, 2017, 1:01 a.m. | OK | GNU C++ | TESTS | 67 | 327 | 74956800 | 2900 | |
| 18096443 | SanSiroWaltz | D | May 26, 2016, 2:56 a.m. | OK | GNU C++ | TESTS | 67 | 529 | 24268800 | 2900 | |
| 26216479 | Manchery | D | April 8, 2017, 10:38 a.m. | OK | GNU C++ | TESTS | 67 | 639 | 15872000 | 2900 | |
| 26233010 | tlzmybm | D | April 9, 2017, 8:43 a.m. | OK | GNU C++ | TESTS | 67 | 686 | 15769600 | 2900 | |
| 26228590 | _LowestJN | D | April 9, 2017, 1:21 a.m. | OK | GNU C++ | TESTS | 67 | 717 | 16384000 | 2900 | |
| 65348958 | 137_345_2814 | D | Nov. 19, 2019, 1:35 p.m. | OK | GNU C++11 | TESTS | 67 | 390 | 105984000 | 2900 | |
| 56690470 | zhaotiensn | D | July 8, 2019, 3:22 a.m. | OK | GNU C++11 | TESTS | 67 | 577 | 15667200 | 2900 | |
| 69198044 | mrsrz | D | Jan. 20, 2020, 3:33 p.m. | OK | GNU C++11 | TESTS | 67 | 639 | 26931200 | 2900 | |
| 56658878 | luogu_bot5 | D | July 7, 2019, 9:18 a.m. | OK | GNU C++11 | TESTS | 67 | 670 | 13312000 | 2900 | |
| 47167612 | Dilute | D | Dec. 17, 2018, 1:18 p.m. | OK | GNU C++11 | TESTS | 67 | 670 | 13721600 | 2900 | |
| 56643110 | shuashuawan | D | July 7, 2019, 3:57 a.m. | OK | GNU C++11 | TESTS | 67 | 670 | 26624000 | 2900 | |
| 47167628 | Dilute | D | Dec. 17, 2018, 1:18 p.m. | OK | GNU C++11 | TESTS | 67 | 685 | 13721600 | 2900 | |
| 56696378 | yugao | D | July 8, 2019, 7:11 a.m. | OK | GNU C++11 | TESTS | 67 | 686 | 13721600 | 2900 | |
| 56658917 | bdcaknoip | D | July 7, 2019, 9:19 a.m. | OK | GNU C++11 | TESTS | 67 | 686 | 13721600 | 2900 | |
| 56772895 | AyoAyowei | D | July 10, 2019, midnight | OK | GNU C++11 | TESTS | 67 | 686 | 14540800 | 2900 | |
| 46816535 | Nostalgically | D | Dec. 9, 2018, 12:42 p.m. | OK | GNU C++14 | TESTS | 67 | 733 | 18534400 | 2900 | |
| 63782296 | luogu_bot3 | D | Oct. 30, 2019, 11:23 a.m. | OK | GNU C++14 | TESTS | 67 | 888 | 11059200 | 2900 | |
| 38808352 | qiqi20021026 | D | May 31, 2018, 4:33 p.m. | OK | GNU C++14 | TESTS | 67 | 889 | 17715200 | 2900 | |
| 46816656 | LittleFairyMY | D | Dec. 9, 2018, 12:45 p.m. | OK | GNU C++14 | TESTS | 67 | 920 | 20275200 | 2900 | |
| 63962673 | Rubbish12345 | D | Nov. 1, 2019, 5:55 a.m. | OK | GNU C++14 | TESTS | 67 | 935 | 12288000 | 2900 | |
| 46816852 | LittleFairyMY | D | Dec. 9, 2018, 12:49 p.m. | OK | GNU C++14 | TESTS | 67 | 951 | 33177600 | 2900 | |
| 63760820 | luogu_bot2 | D | Oct. 30, 2019, 3:33 a.m. | OK | GNU C++14 | TESTS | 67 | 966 | 11059200 | 2900 | |
| 63958499 | zsyzsy | D | Nov. 1, 2019, 3:39 a.m. | OK | GNU C++14 | TESTS | 67 | 982 | 12288000 | 2900 | |
| 23407190 | Ali.Pi | D | Dec. 29, 2016, 8:28 p.m. | OK | GNU C++14 | TESTS | 67 | 1014 | 18329600 | 2900 | |
| 32369633 | NiroBC | D | Nov. 17, 2017, 4:58 a.m. | OK | GNU C++14 | TESTS | 67 | 1560 | 13004800 | 2900 | |
| 57981027 | Kmcode | D | July 30, 2019, 9:24 a.m. | OK | GNU C++17 | TESTS | 67 | 529 | 67993600 | 2900 | |
| 57981350 | Kmcode | D | July 30, 2019, 9:30 a.m. | OK | GNU C++17 | TESTS | 67 | 545 | 67993600 | 2900 | |
| 57872640 | Benq | D | July 28, 2019, 2:59 a.m. | OK | GNU C++17 | TESTS | 67 | 920 | 17510400 | 2900 | |
| 56620435 | ygy | D | July 6, 2019, 11:44 a.m. | OK | GNU C++17 | TESTS | 67 | 936 | 12902400 | 2900 | |
| 50846591 | kefaa2 | D | March 5, 2019, 4:24 p.m. | OK | GNU C++17 | TESTS | 67 | 4757 | 13721600 | 2900 | |
| 19565233 | mmaxio | D | Aug. 1, 2016, 5:03 p.m. | OK | Java 8 | TESTS | 67 | 2371 | 28979200 | 2900 | |
| 18917933 | Los_Angelos_Laycurse | D | July 6, 2016, 11:51 a.m. | OK | MS C++ | TESTS | 67 | 1060 | 19968000 | 2900 |
Back to search problems