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 |
|---|---|---|---|---|---|---|
| 914 | Codecraft-18 and Codeforces Round 458 (Div. 1 + Div. 2, combined) | FINISHED | False | 10800 | 259943123 | Jan. 20, 2018, 3:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 277 ) | H | Ember and Storm's Tree Game | PROGRAMMING | combinatorics dp games trees | 2900 |
Ember and Storm play a game. First, Ember picks a labelled tree T of n vertices, such that the degree of every vertex is at most d . Then, Storm picks two distinct vertices u and v in this tree and writes down the labels of the vertices in the path from u to v in a sequence a 1 , a 2 ... a k . Finally, Ember picks any index i ( 1 ≤ i < k ) in the array. Now he performs one of the following two operations exactly once: flip the subrange i + 1, k and add a i to it. After this, the sequence becomes a 1 , ... a i , a k + a i , a k - 1 + a i , ... a i + 1 + a i negate the subrange i + 1, k and add a i to it. i.e., the array becomes a 1 , ... a i , - a i + 1 + a i , - a i + 2 + a i , ... - a k + a i Ember wins if the array is monotonically increasing or decreasing after this. Otherwise Storm wins. The game can be described by the tuple ( T , u , v , i , op ) where op is «flip» or «negate» depending on the action Ember chose in the last turn. Find the number of tuples that can occur if Ember and Storm play optimally. When they play optimally, if there are multiple moves by which they are guaranteed to win, then they may play any of the winning moves. Otherwise, if someone loses no matter what they play, then they may play any of the possible moves. Report the answer modulo m . The input consists of a single line containing three integers n , d and m ( 2 ≤ n ≤ 200, 1 ≤ d < n , 1 ≤ m ≤ 2·10 9 ). Print a single number — the number of possible tuples if Ember and Storm play as described, modulo m . In the first sample case, there is only one possible tree. There are two possible paths, 1 to 2 and 2 to 1 . For both paths, i can only be 1 , and op can take both possibilities. Therefore, the answer is 4 . In the second sample, there are no possible trees. In the third sample, there are three possible trees. |
| Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 34606854 | zhan8855 | H | Jan. 27, 2018, 1:24 p.m. | OK | GNU C++ | TESTS | 108 | 93 | 2252800 | 2900 | |
| 34507840 | _SHENZHEBEI_ | H | Jan. 24, 2018, 7:40 a.m. | OK | GNU C++ | TESTS | 108 | 109 | 2764800 | 2900 | |
| 34549836 | lastans | H | Jan. 25, 2018, 2:50 p.m. | OK | GNU C++ | TESTS | 108 | 109 | 3686400 | 2900 | |
| 34507866 | _SHENZHEBEI_ | H | Jan. 24, 2018, 7:41 a.m. | OK | GNU C++ | TESTS | 108 | 124 | 2764800 | 2900 | |
| 36445521 | ONION_CYC | H | March 21, 2018, 3:57 a.m. | OK | GNU C++ | TESTS | 108 | 124 | 3993600 | 2900 | |
| 38453482 | WerKeyTom_FTD | H | May 20, 2018, 9:03 a.m. | OK | GNU C++ | TESTS | 108 | 139 | 204800 | 2900 | |
| 57768204 | py_ultron | H | July 25, 2019, 10:11 p.m. | OK | GNU C++11 | TESTS | 108 | 93 | 204800 | 2900 | |
| 41937827 | yyf0309 | H | Aug. 21, 2018, 1:43 p.m. | OK | GNU C++11 | TESTS | 108 | 93 | 512000 | 2900 | |
| 65518774 | cuizhuyefei | H | Nov. 22, 2019, 7:17 a.m. | OK | GNU C++11 | TESTS | 108 | 93 | 716800 | 2900 | |
| 65518409 | cuizhuyefei | H | Nov. 22, 2019, 7:08 a.m. | OK | GNU C++11 | TESTS | 108 | 93 | 716800 | 2900 | |
| 47511827 | samjia2000 | H | Dec. 26, 2018, 7:06 a.m. | OK | GNU C++11 | TESTS | 108 | 93 | 1024000 | 2900 | |
| 57871816 | lopare | H | July 28, 2019, 2:24 a.m. | OK | GNU C++11 | TESTS | 108 | 108 | 204800 | 2900 | |
| 64910080 | Rubbish12345 | H | Nov. 15, 2019, 2:30 a.m. | OK | GNU C++11 | TESTS | 108 | 109 | 409600 | 2900 | |
| 34707043 | dasinlsb | H | Jan. 30, 2018, 11:47 a.m. | OK | GNU C++11 | TESTS | 108 | 109 | 2457600 | 2900 | |
| 37262728 | choutii | H | April 13, 2018, 1:19 a.m. | OK | GNU C++11 | TESTS | 108 | 109 | 3891200 | 2900 | |
| 34415476 | laofudasuan | H | Jan. 21, 2018, 1:33 p.m. | OK | GNU C++11 | TESTS | 108 | 124 | 2764800 | 2900 | |
| 34525094 | boulevard | H | Jan. 24, 2018, 5:56 p.m. | OK | GNU C++14 | TESTS | 108 | 77 | 2457600 | 2900 | |
| 59685179 | Scut82 | H | Aug. 30, 2019, 12:38 a.m. | OK | GNU C++14 | TESTS | 108 | 78 | 512000 | 2900 | |
| 34407667 | apiadu | H | Jan. 21, 2018, 9:25 a.m. | OK | GNU C++14 | TESTS | 108 | 78 | 2457600 | 2900 | |
| 40978533 | ReaLNero1 | H | July 30, 2018, 4:40 p.m. | OK | GNU C++14 | TESTS | 108 | 93 | 512000 | 2900 | |
| 36059205 | jslijin | H | March 8, 2018, 1:34 a.m. | OK | GNU C++14 | TESTS | 108 | 93 | 2252800 | 2900 | |
| 34772340 | WesternBoy | H | Jan. 31, 2018, 3:20 p.m. | OK | GNU C++14 | TESTS | 108 | 93 | 2252800 | 2900 | |
| 34734951 | andronos | H | Jan. 31, 2018, 11:16 a.m. | OK | GNU C++14 | TESTS | 108 | 93 | 2252800 | 2900 | |
| 35587034 | shadowomar111 | H | Feb. 23, 2018, 2:33 a.m. | OK | GNU C++14 | TESTS | 108 | 93 | 2457600 | 2900 | |
| 34539146 | yfzcsc | H | Jan. 25, 2018, 7:42 a.m. | OK | GNU C++14 | TESTS | 108 | 108 | 2252800 | 2900 | |
| 37387615 | strongshahruz | H | April 17, 2018, 5:54 a.m. | OK | GNU C++14 | TESTS | 108 | 108 | 3686400 | 2900 | |
| 51971278 | CMXRYNP | H | March 29, 2019, 12:34 p.m. | OK | GNU C++17 | TESTS | 108 | 109 | 307200 | 2900 | |
| 46288557 | Shayan.P | H | Nov. 27, 2018, 5:57 p.m. | OK | GNU C++17 | TESTS | 108 | 109 | 1024000 | 2900 | |
| 35826697 | InvUsr | H | March 2, 2018, 6:18 a.m. | OK | GNU C++17 | TESTS | 108 | 109 | 2457600 | 2900 | |
| 57429909 | Benq | H | July 21, 2019, 12:01 a.m. | OK | GNU C++17 | TESTS | 108 | 140 | 614400 | 2900 | |
| 41951141 | Buzhibujue | H | Aug. 22, 2018, 1:31 a.m. | OK | GNU C++17 | TESTS | 108 | 140 | 1024000 | 2900 | |
| 34526650 | Los_Angelos_Laycurse | H | Jan. 24, 2018, 7:03 p.m. | OK | MS C++ | TESTS | 108 | 156 | 2457600 | 2900 |
Back to search problems