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 |
---|---|---|---|---|---|---|
1218 | Bubble Cup 12 - Finals [Online Mirror, unrated, Div. 1] | FINISHED | False | 18000 | 168884687 | Sept. 15, 2019, 1:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 135 ) | H | Function Composition | PROGRAMMING | dfs and similar | 2700 |
B"We are definitely not going to bother you with another generic story when Alice finds about an array or when Alice and Bob play some stupid game. This time you'll get a simple, plain text. First, let us define several things. We define function F on the array A such that F(i, 1) = A[i] and F(i, m) = A[F(i, m - 1)] for m > 1 . In other words, value F(i, m) represents composition A[...A[i]] applied m times. You are given an array of length N with non-negative integers. You are expected to give an answer on Q queries. Each query consists of two numbers xe2 x80 x93 m and y . For each query determine how many x exist such that F(x,m) = y . The first line contains one integer N (1 <= q N <= q 2 cdot 10^5) xe2 x80 x93 the size of the array A . The next line contains N non-negative integers xe2 x80 x93 the array A itself (1 <= q A_i <= q N) . The next line contains one integer Q (1 <= q Q <= q 10^5) xe2 x80 x93 the number of queries. Each of the next Q lines contain two integers m and y (1 <= q m <= q 10^{18}, 1 <= q y <= q N) . Output exactly Q lines with a single integer in each that represent the solution. Output the solutions in the order the queries were asked in. For the first query we can notice that F(3, 10) = 1, F(9, 10) = 1 and F(10, 10) = 1 . For the second query no x satisfies condition F(x, 5) = 7 . For the third query F(5, 10) = 6 holds. For the fourth query F(3, 1) = 1. For the fifth query no x satisfies condition F(x, 10) = 8 . "... |
E |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
61582213 | pufanyi | H | Oct. 1, 2019, 2:38 a.m. | OK | GNU C++11 | TESTS | 98 | 93 | 17408000 | 2700 | |
64674875 | IDDFS | H | Nov. 11, 2019, 7:38 a.m. | OK | GNU C++11 | TESTS | 98 | 155 | 51609600 | 2700 | |
64674839 | vjudge1 | H | Nov. 11, 2019, 7:37 a.m. | OK | GNU C++11 | TESTS | 98 | 156 | 51609600 | 2700 | |
64669744 | vjudge2 | H | Nov. 11, 2019, 5:08 a.m. | OK | GNU C++11 | TESTS | 98 | 202 | 49254400 | 2700 | |
61673541 | PO3OBAR_Bblnb | H | Oct. 1, 2019, 7:34 p.m. | OK | GNU C++11 | TESTS | 98 | 343 | 68812800 | 2700 | |
61469351 | Weeeee | H | Sept. 29, 2019, 11:42 a.m. | OK | GNU C++14 | TESTS | 98 | 140 | 42700800 | 2700 | |
60712867 | Heltion | H | Sept. 17, 2019, 9:13 a.m. | OK | GNU C++14 | TESTS | 98 | 171 | 42086400 | 2700 | |
60820218 | krijgertje | H | Sept. 18, 2019, 11:22 p.m. | OK | GNU C++14 | TESTS | 98 | 186 | 32768000 | 2700 | |
60854520 | sajibreadd | H | Sept. 19, 2019, 2:42 p.m. | OK | GNU C++14 | TESTS | 98 | 217 | 52326400 | 2700 | |
60648878 | Denisson ShadowLight DmitryGrigorev | H | Sept. 15, 2019, 6:16 p.m. | OK | GNU C++14 | TESTS | 98 | 233 | 41164800 | 2700 | |
60641054 | 300iq MiFaFaOvO | H | Sept. 15, 2019, 3:25 p.m. | OK | GNU C++14 | TESTS | 98 | 249 | 33996800 | 2700 | |
60725489 | ivan100sic | H | Sept. 17, 2019, 1:44 p.m. | OK | GNU C++17 | TESTS | 98 | 155 | 50688000 | 2700 | |
60725306 | ivan100sic | H | Sept. 17, 2019, 1:40 p.m. | OK | GNU C++17 | TESTS | 98 | 155 | 50688000 | 2700 | |
61472570 | trabbbart Piurko teapotd | H | Sept. 29, 2019, 12:57 p.m. | OK | GNU C++17 | TESTS | 98 | 156 | 35532800 | 2700 | |
60638524 | mango_lassi | H | Sept. 15, 2019, 2:47 p.m. | OK | GNU C++17 | TESTS | 98 | 171 | 14950400 | 2700 | |
64682162 | vjudge3 | H | Nov. 11, 2019, 10:29 a.m. | OK | GNU C++17 | TESTS | 98 | 171 | 27340800 | 2700 | |
60644806 | kdh9949 | H | Sept. 15, 2019, 4:43 p.m. | OK | GNU C++17 | TESTS | 98 | 171 | 34918400 | 2700 | |
60674132 | hmc | H | Sept. 16, 2019, 11:52 a.m. | OK | GNU C++17 | TESTS | 98 | 171 | 45568000 | 2700 | |
62609196 | Trote_w | H | Oct. 15, 2019, 9:03 a.m. | OK | GNU C++17 | TESTS | 98 | 171 | 49766400 | 2700 | |
62063362 | Super_M. | H | Oct. 7, 2019, 2:22 p.m. | OK | GNU C++17 | TESTS | 98 | 186 | 14950400 | 2700 | |
68357496 | jiangly | H | Jan. 7, 2020, 12:44 p.m. | OK | GNU C++17 | TESTS | 98 | 186 | 36454400 | 2700 | |
64689604 | vjudge1 | H | Nov. 11, 2019, 12:45 p.m. | OK | MS C++ | TESTS | 98 | 155 | 17408000 | 2700 |
Back to search problems