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 |
---|---|---|---|---|---|---|
1787 | TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!) | FINISHED | False | 10800 | 62263463 | Jan. 29, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3475 ) | D | Game on Axis | PROGRAMMING | combinatorics ds graphs implementation |
B"There are n points 1,2, ldots,n , each point i has a number a_i on it. You're playing a game on them. Initially, you are at point 1 . When you are at point i , take following steps: Before the game begins, you can choose two integers x and y satisfying 1 <= x <= n , -n <= y <= n and replace a_x with y (set a_x := y ). Find the number of distinct pairs (x,y) such that the game that you start after making the change ends in a finite number of steps. Notice that you do not have to satisfy a_x not=y . Each test contains multiple test cases. The first line contains an integer t ( 1 <= t <= 10^4) -- the number of test cases. The first line of each test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of points. The second line contains n integers a_1,a_2, ldots,a_n ( -n <= a_i <= n ) -- the numbers on the axis. It's guaranteed that the sum of n does not exceed 2 cdot 10^5 . For each test case, print a line containing a single integer -- the number of distinct pairs (x,y) with which the game ends. In the first test case, the pairs (x,y) with which the game ends are (1,-1) and (1,1) , corresponding to the routes 1 rightarrow 0 and 1 rightarrow 2 . Note that (1,2) is invalid since when n=1 , y=2 violates -n <= y <= n . (1,0) is also invalid since you will go from 1 to 1 forever. In the second test case, the pairs are (1,-2),(1,-1),(1,2),(2,-2),(2,-1),(2,0),(2,1),(2,2) . In the fourth test case, the pairs are (1,-2),(1,-1),(1,1),(1,2),(2,-2),(2,1),(2,2) . "... |
TypeDB Forces 2023 (Div. 1 + Div. 2, Rated, Prizes!) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
191144428 | KumaTachiRen | D | Jan. 29, 2023, 4:08 p.m. | OK | C# 8 | TESTS | 35 | 140 | 6348800 | ||
191158538 | Gassa | D | Jan. 29, 2023, 5:12 p.m. | OK | D | TESTS | 35 | 140 | 24371200 | ||
191146804 | FST_Forces | D | Jan. 29, 2023, 4:17 p.m. | OK | FPC | TESTS | 35 | 77 | 3891200 | ||
191144422 | Iamjuruo | D | Jan. 29, 2023, 4:08 p.m. | OK | GNU C11 | TESTS | 35 | 62 | 7270400 | ||
191186757 | rainboy | D | Jan. 29, 2023, 10:22 p.m. | OK | GNU C11 | TESTS | 35 | 108 | 8089600 | ||
191152257 | diamond_ladybug | D | Jan. 29, 2023, 4:42 p.m. | OK | GNU C++14 | TESTS | 35 | 31 | 15564800 | ||
191148228 | minstdfx | D | Jan. 29, 2023, 4:24 p.m. | OK | GNU C++14 | TESTS | 35 | 61 | 14745600 | ||
191144677 | bntti | D | Jan. 29, 2023, 4:09 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 3993600 | ||
191145803 | Flamire | D | Jan. 29, 2023, 4:13 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 4300800 | ||
191147770 | yogahmad77 | D | Jan. 29, 2023, 4:22 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 4403200 | ||
191160060 | YOK | D | Jan. 29, 2023, 5:19 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 5222400 | ||
191153209 | GreatJMore | D | Jan. 29, 2023, 4:47 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 5324800 | ||
191159285 | whilekim1 | D | Jan. 29, 2023, 5:15 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 7270400 | ||
191150656 | FC_Viiiiictor_K | D | Jan. 29, 2023, 4:34 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 9830400 | ||
191158666 | caijianhong | D | Jan. 29, 2023, 5:13 p.m. | OK | GNU C++14 | TESTS | 35 | 62 | 12083200 | ||
191143570 | lddlinan | D | Jan. 29, 2023, 4:05 p.m. | OK | GNU C++17 | TESTS | 35 | 46 | 5222400 | ||
191148192 | Leocsse | D | Jan. 29, 2023, 4:24 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 2355200 | ||
191150287 | fishy15 | D | Jan. 29, 2023, 4:33 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 2457600 | ||
191161833 | igoroogle | D | Jan. 29, 2023, 5:28 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 3276800 | ||
191160039 | ConquerorOfMyself | D | Jan. 29, 2023, 5:19 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 4403200 | ||
191170077 | Nathan_McKane | D | Jan. 29, 2023, 6:46 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 4812800 | ||
191143801 | pyromahe | D | Jan. 29, 2023, 4:05 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 4915200 | ||
191158108 | Jughead | D | Jan. 29, 2023, 5:10 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 5734400 | ||
191172993 | Chelovek9 | D | Jan. 29, 2023, 7:11 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 7372800 | ||
191146242 | wowo123123 | D | Jan. 29, 2023, 4:15 p.m. | OK | GNU C++17 | TESTS | 35 | 62 | 9830400 | ||
191152266 | FromTheHell | D | Jan. 29, 2023, 4:42 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 31 | 20070400 | ||
191157415 | Hytidel | D | Jan. 29, 2023, 5:07 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 46 | 3276800 | ||
191184563 | AGG | D | Jan. 29, 2023, 9:41 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 46 | 3276800 | ||
191173546 | xyl1234 | D | Jan. 29, 2023, 7:16 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 46 | 6041600 | ||
191199643 | strange757 | D | Jan. 30, 2023, 3:21 a.m. | OK | GNU C++17 (64) | TESTS | 37 | 46 | 19251200 | ||
191159237 | deepak_sriram | D | Jan. 29, 2023, 5:15 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 61 | 9932800 | ||
191152517 | stan23456 | D | Jan. 29, 2023, 4:43 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 1740800 | ||
191155856 | minmise | D | Jan. 29, 2023, 4:59 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 2457600 | ||
191161751 | wakaranai | D | Jan. 29, 2023, 5:27 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 8806400 | ||
191149638 | katoli_4 | D | Jan. 29, 2023, 4:30 p.m. | OK | GNU C++17 (64) | TESTS | 35 | 62 | 10342400 | ||
191180969 | beot | D | Jan. 29, 2023, 8:44 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 1843200 | ||
191153724 | Anhdung1478 | D | Jan. 29, 2023, 4:49 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 2867200 | ||
191158612 | nofap | D | Jan. 29, 2023, 5:12 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3276800 | ||
191157680 | maslory | D | Jan. 29, 2023, 5:08 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3276800 | ||
191183299 | COMPL3XITY | D | Jan. 29, 2023, 9:20 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3276800 | ||
191161223 | Zadymiarz1234 | D | Jan. 29, 2023, 5:25 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3276800 | ||
191145985 | ParsaDox | D | Jan. 29, 2023, 4:14 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3481600 | ||
191163217 | mehrunesartem | D | Jan. 29, 2023, 5:33 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3686400 | ||
191150610 | dranjohn | D | Jan. 29, 2023, 4:34 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3993600 | ||
191158495 | MikaKoKo | D | Jan. 29, 2023, 5:12 p.m. | OK | GNU C++20 (64) | TESTS | 35 | 46 | 3993600 | ||
191202732 | Dinesh_Pandiyan | D | Jan. 30, 2023, 4:12 a.m. | OK | Java 11 | TESTS | 37 | 202 | 8396800 | ||
191150845 | procrastinate7 | D | Jan. 29, 2023, 4:35 p.m. | OK | Java 11 | TESTS | 35 | 233 | 0 | ||
191155583 | DarLam | D | Jan. 29, 2023, 4:58 p.m. | OK | Java 11 | TESTS | 35 | 264 | 7782400 | ||
191156117 | HugeHobbit | D | Jan. 29, 2023, 5 p.m. | OK | Java 11 | TESTS | 35 | 296 | 9216000 | ||
191162599 | lpipes | D | Jan. 29, 2023, 5:31 p.m. | OK | Java 11 | TESTS | 35 | 296 | 12492800 | ||
191153915 | knightL | D | Jan. 29, 2023, 4:50 p.m. | OK | Java 11 | TESTS | 35 | 327 | 8499200 | ||
191146978 | profchi | D | Jan. 29, 2023, 4:18 p.m. | OK | Java 11 | TESTS | 35 | 358 | 20684800 | ||
191170474 | dzhi | D | Jan. 29, 2023, 6:49 p.m. | OK | Java 11 | TESTS | 35 | 436 | 27852800 | ||
191149351 | Dukkha | D | Jan. 29, 2023, 4:28 p.m. | OK | Java 17 | TESTS | 35 | 202 | 307200 | ||
191150474 | pc_invader | D | Jan. 29, 2023, 4:34 p.m. | OK | Java 17 | TESTS | 35 | 405 | 37478400 | ||
191204088 | jiajieshi | D | Jan. 30, 2023, 4:36 a.m. | OK | Java 17 | TESTS | 37 | 561 | 78540800 | ||
191144758 | MagentaCobra | D | Jan. 29, 2023, 4:09 p.m. | OK | Java 8 | TESTS | 35 | 187 | 2969600 | ||
191155768 | sachinjaiswal | D | Jan. 29, 2023, 4:59 p.m. | OK | Java 8 | TESTS | 35 | 202 | 3686400 | ||
191189181 | IanISam | D | Jan. 29, 2023, 11:18 p.m. | OK | Java 8 | TESTS | 35 | 248 | 12083200 | ||
191146394 | golions | D | Jan. 29, 2023, 4:16 p.m. | OK | Java 8 | TESTS | 35 | 249 | 6656000 | ||
191175453 | megaspazz | D | Jan. 29, 2023, 7:36 p.m. | OK | Java 8 | TESTS | 35 | 264 | 17203200 | ||
191175682 | megaspazz | D | Jan. 29, 2023, 7:39 p.m. | OK | Java 8 | TESTS | 35 | 265 | 17203200 | ||
191151944 | Socrates1232 | D | Jan. 29, 2023, 4:40 p.m. | OK | Java 8 | TESTS | 35 | 280 | 32972800 | ||
191159989 | 12312sa | D | Jan. 29, 2023, 5:19 p.m. | OK | Java 8 | TESTS | 35 | 421 | 0 | ||
191200796 | harshsingla06 | D | Jan. 30, 2023, 3:40 a.m. | OK | Java 8 | TESTS | 37 | 452 | 79564800 | ||
191162287 | 1091857051 | D | Jan. 29, 2023, 5:30 p.m. | OK | Java 8 | TESTS | 35 | 499 | 37171200 | ||
191145643 | FastFreeTask | D | Jan. 29, 2023, 4:13 p.m. | OK | Kotlin 1.6 | TESTS | 35 | 390 | 37990400 | ||
191159685 | Alexey | D | Jan. 29, 2023, 5:17 p.m. | OK | MS C++ 2017 | TESTS | 35 | 233 | 8806400 | ||
191196714 | shehebe | D | Jan. 30, 2023, 2:29 a.m. | OK | PyPy 3 | TESTS | 37 | 483 | 22016000 | ||
191143414 | SPD_9X2 | D | Jan. 29, 2023, 4:04 p.m. | OK | PyPy 3 | TESTS | 35 | 529 | 33177600 | ||
191174288 | 111vad111 | D | Jan. 29, 2023, 7:23 p.m. | OK | PyPy 3 | TESTS | 35 | 530 | 16691200 | ||
191185784 | bpdolson | D | Jan. 29, 2023, 10:01 p.m. | OK | PyPy 3 | TESTS | 35 | 623 | 26316800 | ||
191146453 | titia | D | Jan. 29, 2023, 4:16 p.m. | OK | PyPy 3 | TESTS | 35 | 872 | 152883200 | ||
191143639 | misorin | D | Jan. 29, 2023, 4:05 p.m. | OK | PyPy 3-64 | TESTS | 35 | 248 | 41062400 | ||
191159668 | hxu10 | D | Jan. 29, 2023, 5:17 p.m. | OK | PyPy 3-64 | TESTS | 35 | 280 | 26726400 | ||
191144757 | eepsilon | D | Jan. 29, 2023, 4:09 p.m. | OK | PyPy 3-64 | TESTS | 35 | 295 | 40140800 | ||
191153734 | dgrachev28 | D | Jan. 29, 2023, 4:49 p.m. | OK | PyPy 3-64 | TESTS | 35 | 296 | 154419200 | ||
191145451 | plevande | D | Jan. 29, 2023, 4:12 p.m. | OK | PyPy 3-64 | TESTS | 35 | 311 | 37990400 | ||
191143007 | Maruzensky | D | Jan. 29, 2023, 4:02 p.m. | OK | PyPy 3-64 | TESTS | 35 | 311 | 39219200 | ||
191193849 | ZrjaK | D | Jan. 30, 2023, 1:31 a.m. | OK | PyPy 3-64 | TESTS | 36 | 327 | 34611200 | ||
191197720 | Little_Sheep_Yawn | D | Jan. 30, 2023, 2:50 a.m. | OK | PyPy 3-64 | TESTS | 37 | 327 | 38707200 | ||
191145218 | dabbler1 | D | Jan. 29, 2023, 4:11 p.m. | OK | PyPy 3-64 | TESTS | 35 | 343 | 26419200 | ||
191142716 | xxh1999 | D | Jan. 29, 2023, 4:01 p.m. | OK | PyPy 3-64 | TESTS | 35 | 343 | 28979200 | ||
191201111 | 00zijian | D | Jan. 30, 2023, 3:45 a.m. | OK | Python 3 | TESTS | 37 | 358 | 22323200 | ||
191143696 | r57shell | D | Jan. 29, 2023, 4:05 p.m. | OK | Python 3 | TESTS | 35 | 451 | 21299200 | ||
191145249 | yupooh | D | Jan. 29, 2023, 4:11 p.m. | OK | Python 3 | TESTS | 35 | 998 | 36864000 | ||
191159561 | PugachAG | D | Jan. 29, 2023, 5:17 p.m. | OK | Rust 2021 | TESTS | 35 | 62 | 17612800 |
Back to search problems