Codeforces Round 839 (Div. 3)

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
1772 Codeforces Round 839 (Div. 3) FINISHED False 8100 65805863 Dec. 18, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6943 ) E Permutation Game PROGRAMMING games

B"Two players are playing a game. They have a permutation of integers 1 , 2 , ..., n (a permutation is an array where each element from 1 to n occurs exactly once). The permutation is not sorted in either ascending or descending order (i. xe2 x80 x89e. the permutation does not have the form [1, 2, ... , n] or [n, n-1, ... , 1] ). Initially, all elements of the permutation are colored red. The players take turns. On their turn, the player can do one of three actions: The first player wins if the permutation is sorted in ascending order (i. xe2 x80 x89e. it becomes [1, 2, ... , n] ). The second player wins if the permutation is sorted in descending order (i. xe2 x80 x89e. it becomes [n, n-1, ... , 1] ). If the game lasts for 100^{500} turns and nobody wins, it ends in a draw. Your task is to determine the result of the game if both players play optimally. The first line contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The first line of each test case contains a single integer n ( 3 <= n <= 5 cdot 10^5 ) -- the size of the permutation. The second line contains n integers p_1, p_2, ... , p_n -- the permutation itself. The permutation p is not sorted in either ascending or descending order. The sum of n over all test cases does not exceed 5 cdot 10^5 . For each test case, print First if the first player wins, Second if the second player wins, and Tie if the result is a draw. Let's show how the first player wins in the first example. They should color the elements 3 and 4 blue during their first two turns, and then they can reorder the blue elements in such a way that the permutation becomes [1, 2, 3, 4] . The second player can neither interfere with this strategy nor win faster. "...

Tutorials

110313

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
186040468 mban259 E Dec. 19, 2022, 8:19 p.m. OK C# 10 TESTS 23 109 39833600
186055636 INF_512 E Dec. 20, 2022, 3:11 a.m. OK GNU C++14 TESTS 23 93 0
186044935 Gastan E Dec. 19, 2022, 9:45 p.m. OK GNU C++14 TESTS 23 124 0
186035101 _martynas E Dec. 19, 2022, 7:18 p.m. OK GNU C++14 TESTS 23 124 0
185909697 dimitri1244 E Dec. 19, 2022, 5:08 a.m. OK GNU C++14 TESTS 23 124 0
185906995 I_love_forever_you E Dec. 19, 2022, 4:18 a.m. OK GNU C++14 TESTS 23 124 0
185906114 tsl07 E Dec. 19, 2022, 3:59 a.m. OK GNU C++14 TESTS 23 124 0
185904441 Luban E Dec. 19, 2022, 3:21 a.m. OK GNU C++14 TESTS 23 124 0
185898772 zltzlt E Dec. 19, 2022, 12:13 a.m. OK GNU C++14 TESTS 23 124 0
185898769 zltzlt E Dec. 19, 2022, 12:13 a.m. OK GNU C++14 TESTS 23 124 0
186036244 wwawwaww E Dec. 19, 2022, 7:29 p.m. OK GNU C++14 TESTS 23 124 2048000
186055101 chengcheng5677 E Dec. 20, 2022, 3:01 a.m. OK GNU C++17 TESTS 23 124 0
185955329 Invisible_Shadow E Dec. 19, 2022, 1:47 p.m. OK GNU C++17 TESTS 23 124 0
185953344 Potoccino. E Dec. 19, 2022, 1:28 p.m. OK GNU C++17 TESTS 23 124 0
185931150 Www_hy E Dec. 19, 2022, 9:41 a.m. OK GNU C++17 TESTS 23 124 0
185926759 MohamedAboOkail E Dec. 19, 2022, 8:52 a.m. OK GNU C++17 TESTS 23 124 0
185924079 PythonBytes E Dec. 19, 2022, 8:21 a.m. OK GNU C++17 TESTS 23 124 0
185908236 itachi_uchiha118 E Dec. 19, 2022, 4:42 a.m. OK GNU C++17 TESTS 23 124 0
185906616 Kicamon E Dec. 19, 2022, 4:10 a.m. OK GNU C++17 TESTS 23 124 0
185906033 longcheng_x E Dec. 19, 2022, 3:58 a.m. OK GNU C++17 TESTS 23 124 0
185905650 chhhr E Dec. 19, 2022, 3:50 a.m. OK GNU C++17 TESTS 23 124 0
185951473 EotUL8d7 E Dec. 19, 2022, 1:11 p.m. OK GNU C++17 (64) TESTS 23 77 2048000
185888166 _BugSlayer_ E Dec. 18, 2022, 7:49 p.m. OK GNU C++17 (64) TESTS 23 77 3993600
186064891 alif_cse_ju E Dec. 20, 2022, 5:43 a.m. OK GNU C++17 (64) TESTS 23 78 0
185953142 Falkye E Dec. 19, 2022, 1:26 p.m. OK GNU C++17 (64) TESTS 23 78 0
186050387 NK_ E Dec. 20, 2022, 12:50 a.m. OK GNU C++17 (64) TESTS 23 78 2048000
185952254 kumaraditya1999 E Dec. 19, 2022, 1:18 p.m. OK GNU C++17 (64) TESTS 23 78 2048000
185913411 BuptNorthRemembers E Dec. 19, 2022, 6:13 a.m. OK GNU C++17 (64) TESTS 23 78 2048000
186035841 julianferres E Dec. 19, 2022, 7:25 p.m. OK GNU C++17 (64) TESTS 23 78 3993600
185927259 long_long_int E Dec. 19, 2022, 8:58 a.m. OK GNU C++17 (64) TESTS 23 78 3993600
185905656 ......77 E Dec. 19, 2022, 3:50 a.m. OK GNU C++17 (64) TESTS 23 78 3993600
186052960 martinius E Dec. 20, 2022, 2:04 a.m. OK GNU C++20 (64) TESTS 23 62 0
186039983 CatStevens E Dec. 19, 2022, 8:11 p.m. OK GNU C++20 (64) TESTS 23 62 0
185937951 hayyan-wannous E Dec. 19, 2022, 10:56 a.m. OK GNU C++20 (64) TESTS 23 62 0
185934007 acfmidinsw E Dec. 19, 2022, 10:13 a.m. OK GNU C++20 (64) TESTS 23 62 0
185930908 ChinaDWH E Dec. 19, 2022, 9:38 a.m. OK GNU C++20 (64) TESTS 23 62 0
185929094 2021sgy E Dec. 19, 2022, 9:18 a.m. OK GNU C++20 (64) TESTS 23 62 0
185917366 Dev_Manus E Dec. 19, 2022, 7:03 a.m. OK GNU C++20 (64) TESTS 23 62 0
185909289 wuningzhixia1234 E Dec. 19, 2022, 5:01 a.m. OK GNU C++20 (64) TESTS 23 62 0
185908838 nguyentunglam E Dec. 19, 2022, 4:53 a.m. OK GNU C++20 (64) TESTS 23 62 0
185906664 huangqingyang E Dec. 19, 2022, 4:11 a.m. OK GNU C++20 (64) TESTS 23 62 0
185906100 pushkar.lonkar21 E Dec. 19, 2022, 3:59 a.m. OK Java 11 TESTS 23 186 0
185889500 uttaran_das E Dec. 18, 2022, 8:08 p.m. OK Java 11 TESTS 23 404 46489600
185881474 leoncn E Dec. 18, 2022, 6:12 p.m. OK Java 11 TESTS 23 764 0
185880911 leoncn E Dec. 18, 2022, 6:03 p.m. OK Java 11 TESTS 23 810 0
185881099 Jackyjuman E Dec. 18, 2022, 6:06 p.m. OK Java 11 TESTS 23 889 8908800
185896483 profchi E Dec. 18, 2022, 10:41 p.m. OK Java 11 TESTS 23 935 5529600
185915858 PriyaAnu E Dec. 19, 2022, 6:45 a.m. OK Java 11 TESTS 23 1279 0
185955846 harini_gurram E Dec. 19, 2022, 1:51 p.m. OK Java 11 TESTS 23 1294 0
186057814 ypa E Dec. 20, 2022, 3:49 a.m. OK Java 17 TESTS 23 233 204800
185904155 crush24 E Dec. 19, 2022, 3:15 a.m. OK Java 17 TESTS 23 623 42188800
185889185 yashbhardwaj24 E Dec. 18, 2022, 8:04 p.m. OK Java 17 TESTS 23 623 42188800
186028062 hit_refresh E Dec. 19, 2022, 6:18 p.m. OK Java 17 TESTS 23 1013 1331200
186025597 hit_refresh E Dec. 19, 2022, 6:01 p.m. OK Java 17 TESTS 23 1653 68198400
186059382 cys02 E Dec. 20, 2022, 4:16 a.m. OK Java 8 TESTS 23 187 13824000
186009207 khan1121 E Dec. 19, 2022, 4:28 p.m. OK Java 8 TESTS 23 717 13824000
185908939 depurador_ik E Dec. 19, 2022, 4:55 a.m. OK Java 8 TESTS 23 764 13824000
185932483 reversir E Dec. 19, 2022, 9:54 a.m. OK MS C++ 2017 TESTS 23 623 0
185918327 mianbizhe E Dec. 19, 2022, 7:13 a.m. OK MS C++ 2017 TESTS 23 670 3993600
185944799 bongcloud7777 E Dec. 19, 2022, 12:06 p.m. OK PyPy 3 TESTS 23 451 34713600
185907264 bokunopicolo E Dec. 19, 2022, 4:23 a.m. OK PyPy 3 TESTS 23 592 58265600
185910127 k3x9_ E Dec. 19, 2022, 5:14 a.m. OK PyPy 3 TESTS 23 1980 31846400
185898895 aakashc E Dec. 19, 2022, 12:19 a.m. OK PyPy 3 TESTS 23 2230 76595200
185898799 aakashc E Dec. 19, 2022, 12:14 a.m. OK PyPy 3 TESTS 23 2261 76185600
186059661 SophieHatter E Dec. 20, 2022, 4:21 a.m. OK PyPy 3-64 TESTS 23 171 59084800
186006337 HaisTous E Dec. 19, 2022, 4:21 p.m. OK PyPy 3-64 TESTS 23 187 61440000
185937632 ketanraut88 E Dec. 19, 2022, 10:53 a.m. OK PyPy 3-64 TESTS 23 202 53964800
186052747 hkwu6013 E Dec. 20, 2022, 1:58 a.m. OK PyPy 3-64 TESTS 23 202 54476800
185896282 Amay12 E Dec. 18, 2022, 10:33 p.m. OK PyPy 3-64 TESTS 23 202 55603200
185901444 onemoreq E Dec. 19, 2022, 2:02 a.m. OK PyPy 3-64 TESTS 23 202 55808000
185931622 HaisTous E Dec. 19, 2022, 9:45 a.m. OK PyPy 3-64 TESTS 23 249 59699200
185950966 beethoven97 E Dec. 19, 2022, 1:06 p.m. OK PyPy 3-64 TESTS 23 358 73523200
185950638 beethoven97 E Dec. 19, 2022, 1:02 p.m. OK PyPy 3-64 TESTS 23 358 78745600
185901954 beethoven97 E Dec. 19, 2022, 2:18 a.m. OK PyPy 3-64 TESTS 23 373 81408000
185931501 HaisTous E Dec. 19, 2022, 9:44 a.m. OK Python 3 TESTS 23 592 30924800
185891989 bogdan_ii E Dec. 18, 2022, 8:49 p.m. OK Python 3 TESTS 23 592 32563200
185931159 HaisTous E Dec. 19, 2022, 9:41 a.m. OK Python 3 TESTS 23 1310 30924800
185968723 mdshadesh E Dec. 19, 2022, 2:52 p.m. OK Python 3 TESTS 23 1326 31334400
186015917 darshan_prabhu E Dec. 19, 2022, 5:05 p.m. OK Python 3 TESTS 23 1340 31334400
185927125 thevaibhavdixit E Dec. 19, 2022, 8:57 a.m. OK Python 3 TESTS 23 1372 31334400
185946107 broshen E Dec. 19, 2022, 12:20 p.m. OK Python 3 TESTS 23 1419 31334400
185941113 N3RFED E Dec. 19, 2022, 11:28 a.m. OK Python 3 TESTS 23 1762 64716800
185903907 Sempr E Dec. 19, 2022, 3:09 a.m. OK Rust 2021 TESTS 23 31 9318400
186021544 pohzipohzi E Dec. 19, 2022, 5:35 p.m. OK Rust 2021 TESTS 23 78 29491200

remove filters

Back to search problems