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 |
---|---|---|---|---|---|---|
1083 | Codeforces Round 526 (Div. 1) | FINISHED | False | 7200 | 193065923 | Dec. 10, 2018, 4:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 954 ) | C | Max Mex | PROGRAMMING | data structures trees | 2800 |
B"Once Grisha found a tree (connected graph without cycles) with a root in node 1 . But this tree was not just a tree. A permutation p of integers from 0 to n - 1 is written in nodes, a number p_i is written in node i . As Grisha likes to invent some strange and interesting problems for himself, but not always can solve them, you need to help him deal with two types of queries on this tree. Let's define a function MEX(S) , where S is a set of non-negative integers, as a smallest non-negative integer that is not included in this set. Let l be a simple path in this tree. So let's define indices of nodes which lie on l as u_1 , u_2 , ldots , u_k . Define V(l) as a set { p_{u_1} , p_{u_2} , ldots , p_{u_k} }. Then queries are: The first line contains a single integer n ( 2 <= q n <= q 2 cdot 10^5 ) -- the number of nodes of a tree. The second line contains n integers -- p_1 , p_2 , ldots , p_n ( 0 <= q p_i < n ) -- the permutation p , it's guaranteed that all numbers are different . The third line contains n - 1 integers -- d_2 , d_3 , ldots , d_n ( 1 <= q d_i < i ), where d_i is a direct ancestor of node i in a tree. The fourth line contains a single integer q ( 1 <= q q <= q 2 cdot 10^5 ) -- the number of queries. The following q lines contain the description of queries: At the beginning of each of next q lines, there is a single integer t ( 1 or 2 ) -- the type of a query: For each type 2 query print a single integer -- the answer for this query. Number written in brackets is a permutation value of a node. "... |
63753 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
48019755 | 170104100115 | C | Jan. 6, 2019, 4:26 a.m. | OK | GNU C++11 | TESTS | 114 | 295 | 38092800 | 2800 | |
50792038 | luogu_bot1 | C | March 4, 2019, 4:13 p.m. | OK | GNU C++11 | TESTS | 114 | 295 | 70963200 | 2800 | |
49305839 | Memory_of_winter | C | Feb. 1, 2019, 5:43 a.m. | OK | GNU C++11 | TESTS | 114 | 296 | 27340800 | 2800 | |
47388562 | AuqaKyz | C | Dec. 23, 2018, 6:46 a.m. | OK | GNU C++11 | TESTS | 114 | 311 | 38092800 | 2800 | |
52765984 | Slr2002 | C | April 15, 2019, 3:34 a.m. | OK | GNU C++11 | TESTS | 114 | 311 | 42803200 | 2800 | |
60302475 | pbihao | C | Sept. 9, 2019, 12:40 p.m. | OK | GNU C++11 | TESTS | 114 | 326 | 29798400 | 2800 | |
66456112 | yinghua1314 | C | Dec. 7, 2019, 1:12 p.m. | OK | GNU C++11 | TESTS | 114 | 327 | 40755200 | 2800 | |
52772025 | Slr2002 | C | April 15, 2019, 9:32 a.m. | OK | GNU C++11 | TESTS | 114 | 342 | 26726400 | 2800 | |
66459445 | yinghua1314 | C | Dec. 7, 2019, 2:17 p.m. | OK | GNU C++11 | TESTS | 114 | 358 | 40755200 | 2800 | |
49561728 | TrumPence | C | Feb. 7, 2019, 12:54 p.m. | OK | GNU C++11 | TESTS | 114 | 358 | 59289600 | 2800 | |
50886354 | mayaohua2003 | C | March 6, 2019, 11:28 a.m. | OK | GNU C++14 | TESTS | 114 | 405 | 39731200 | 2800 | |
50881844 | mayaohua2003 | C | March 6, 2019, 9:14 a.m. | OK | GNU C++14 | TESTS | 114 | 451 | 22118400 | 2800 | |
47669751 | _Sakits | C | Dec. 29, 2018, 4:44 a.m. | OK | GNU C++14 | TESTS | 114 | 452 | 50176000 | 2800 | |
46892755 | newbiegcz | C | Dec. 11, 2018, 7:19 a.m. | OK | GNU C++14 | TESTS | 113 | 467 | 26828800 | 2800 | |
47958430 | vjudge4 | C | Jan. 5, 2019, 7:52 a.m. | OK | GNU C++14 | TESTS | 114 | 468 | 38092800 | 2800 | |
47958409 | vjudge1 | C | Jan. 5, 2019, 7:50 a.m. | OK | GNU C++14 | TESTS | 114 | 483 | 38092800 | 2800 | |
47958389 | vjudge1 | C | Jan. 5, 2019, 7:50 a.m. | OK | GNU C++14 | TESTS | 114 | 483 | 38092800 | 2800 | |
47317477 | shaochengxi | C | Dec. 21, 2018, 5:21 a.m. | OK | GNU C++14 | TESTS | 114 | 514 | 23756800 | 2800 | |
46888885 | __ShaW | C | Dec. 11, 2018, 3:55 a.m. | OK | GNU C++14 | TESTS | 113 | 514 | 41164800 | 2800 | |
46937571 | qiqi20021026 | C | Dec. 12, 2018, 2:40 p.m. | OK | GNU C++14 | TESTS | 113 | 514 | 47718400 | 2800 | |
46883043 | MrDindows | C | Dec. 10, 2018, 8:32 p.m. | OK | GNU C++17 | TESTS | 113 | 296 | 35328000 | 2800 | |
46987974 | MrDindows | C | Dec. 13, 2018, 10:31 p.m. | OK | GNU C++17 | TESTS | 113 | 311 | 35328000 | 2800 | |
48655247 | ReaLNero1 | C | Jan. 21, 2019, 2:09 a.m. | OK | GNU C++17 | TESTS | 114 | 312 | 35328000 | 2800 | |
62260172 | disposrestfuIly | C | Oct. 10, 2019, 11:58 a.m. | OK | GNU C++17 | TESTS | 114 | 342 | 30515200 | 2800 | |
46902172 | djqtxdy | C | Dec. 11, 2018, 12:30 p.m. | OK | GNU C++17 | TESTS | 113 | 358 | 43827200 | 2800 | |
56878321 | hongzhiyin | C | July 12, 2019, 9:13 a.m. | OK | GNU C++17 | TESTS | 114 | 436 | 26009600 | 2800 | |
46882233 | Anadi | C | Dec. 10, 2018, 8:02 p.m. | OK | GNU C++17 | TESTS | 113 | 452 | 33587200 | 2800 | |
47388446 | RDDCCD | C | Dec. 23, 2018, 6:42 a.m. | OK | GNU C++17 | TESTS | 114 | 467 | 24473600 | 2800 | |
47388496 | AuqaKyz | C | Dec. 23, 2018, 6:44 a.m. | OK | GNU C++17 | TESTS | 114 | 468 | 24473600 | 2800 | |
46874242 | MrDindows | C | Dec. 10, 2018, 5:59 p.m. | OK | GNU C++17 | TESTS | 113 | 483 | 41062400 | 2800 | |
67634569 | dalt | C | Dec. 26, 2019, 6:10 a.m. | OK | Java 8 | TESTS | 114 | 1762 | 115097600 | 2800 | |
68831853 | SecondThread | C | Jan. 14, 2020, 11:09 p.m. | OK | Java 8 | TESTS | 114 | 2947 | 127692800 | 2800 | |
50081604 | tri | C | Feb. 18, 2019, 4:35 a.m. | OK | Java 8 | TESTS | 114 | 2994 | 132710400 | 2800 | |
51934354 | kobae964 | C | March 28, 2019, 11:52 a.m. | OK | Rust | TESTS | 114 | 639 | 32460800 | 2800 | |
51934575 | kobae964 | C | March 28, 2019, 11:57 a.m. | OK | Rust | TESTS | 114 | 655 | 30310400 | 2800 | |
51918330 | kobae964 | C | March 28, 2019, 1:11 a.m. | OK | Rust | TESTS | 114 | 2059 | 45363200 | 2800 | |
51918220 | kobae964 | C | March 28, 2019, 1 a.m. | OK | Rust | TESTS | 114 | 2183 | 45363200 | 2800 |
Back to search problems