Codeforces Round 983 (Div. 2)

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
2032 Codeforces Round 983 (Div. 2) FINISHED False 7200 45933923 Nov. 1, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 479 ) F Peanuts PROGRAMMING combinatorics dp games math

Having the magical beanstalk, Jack has been gathering a lot of peanuts lately. Eventually, he has obtained (n) pockets of peanuts, conveniently numbered (1) to (n) from left to right. The (i)-th pocket has (a_i) peanuts. Jack and his childhood friend Alice decide to play a game around the peanuts. First, Alice divides the pockets into some boxes; each box will have a non-zero number of consecutive pockets, and each pocket will, obviously, belong to exactly one box. At the same time, Alice does not change the order of the boxes, that is, the boxes are numbered in ascending order of the indices of the pockets in them. After that, Alice and Jack will take turns alternately, with Alice going first. At each turn, the current player will remove a positive number of peanuts from exactly one pocket which belongs to the leftmost non-empty box (i.e., the leftmost box containing at least one non-empty pocket). In other words, if we number the boxes from left to right, then each player can only pick peanuts from the pocket in the (j)-th box ((j \ge 2)) only if the ((j - 1))-th box has no peanuts left. The player who cannot make a valid move loses. Alice is sure she will win since she has the advantage of dividing the pockets into boxes herself. Thus, she wanted to know how many ways there are for her to divide the peanuts into boxes at the start of the game so that she will win, assuming both players play optimally. Can you help her with the calculation? As the result can be very large, output it modulo (998\,244\,353). Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \leq n \leq 10^6)) — the number of pockets. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ($$$1 \leq a_i \leq 10^9$

Tutorials

Codeforces Round 983 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
289350709 ltf0501 F Nov. 2, 2024, 3:57 a.m. OK C++17 (GCC 7-32) TESTS 52 265 8294400
289349005 Chenly F Nov. 2, 2024, 3:34 a.m. OK C++17 (GCC 7-32) TESTS 52 328 16076800
289358777 zac2010 F Nov. 2, 2024, 5:35 a.m. OK C++17 (GCC 7-32) TESTS 52 343 8089600
289301659 Kilani F Nov. 1, 2024, 6:13 p.m. OK C++17 (GCC 7-32) TESTS 52 343 12083200
289290800 huangleyi F Nov. 1, 2024, 5:20 p.m. OK C++17 (GCC 7-32) TESTS 52 812 53964800
289347168 Joe2011 F Nov. 2, 2024, 3:06 a.m. OK C++17 (GCC 7-32) TESTS 52 1515 53760000
289332969 methanol F Nov. 1, 2024, 10:03 p.m. OK C++17 (GCC 7-32) TESTS 52 2249 85811200
289349432 -Manasvi- F Nov. 2, 2024, 3:40 a.m. OK C++17 (GCC 7-32) TESTS 52 2452 74649600
289298286 Darko1 F Nov. 1, 2024, 5:57 p.m. OK C++17 (GCC 7-32) TESTS 52 2593 86528000
289312407 abeker F Nov. 1, 2024, 7:08 p.m. OK C++17 (GCC 7-32) TESTS 52 3843 169062400
289345466 EasonTAO F Nov. 2, 2024, 2:39 a.m. OK C++20 (GCC 13-64) TESTS 52 218 4300800
289359853 ryno F Nov. 2, 2024, 5:45 a.m. OK C++20 (GCC 13-64) TESTS 52 234 4300800
289338817 k1r1t0 F Nov. 2, 2024, 12:23 a.m. OK C++20 (GCC 13-64) TESTS 52 249 17715200
289355900 _Rise F Nov. 2, 2024, 5:04 a.m. OK C++20 (GCC 13-64) TESTS 52 249 32153600
289290910 sevlll777 F Nov. 1, 2024, 5:20 p.m. OK C++20 (GCC 13-64) TESTS 52 264 36454400
289355757 SanathK F Nov. 2, 2024, 5:03 a.m. OK C++20 (GCC 13-64) TESTS 52 390 28262400
289308684 nuyoah007 F Nov. 1, 2024, 6:48 p.m. OK C++20 (GCC 13-64) TESTS 52 468 3072000
289355882 DylanSmith F Nov. 2, 2024, 5:04 a.m. OK C++20 (GCC 13-64) TESTS 52 484 37683200
289309326 EyadBT F Nov. 1, 2024, 6:52 p.m. OK C++20 (GCC 13-64) TESTS 52 562 41676800
289284100 _lbw_ F Nov. 1, 2024, 4:32 p.m. OK C++20 (GCC 13-64) TESTS 52 764 80179200
289357938 Jalal_molla F Nov. 2, 2024, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 218 4403200
289293663 AkiLotus F Nov. 1, 2024, 5:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 234 4403200
289297438 MrBrionix F Nov. 1, 2024, 5:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 249 8396800
289334215 DOZ F Nov. 1, 2024, 10:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 249 24473600
289344508 OutsiderZz F Nov. 2, 2024, 2:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 265 409600
289335962 waipoli F Nov. 1, 2024, 11:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 1124 190771200
289292427 415411 F Nov. 1, 2024, 5:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 1499 70963200
289349636 hyman00 F Nov. 2, 2024, 3:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 52 2593 211251200
289291728 415411 F Nov. 1, 2024, 5:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 2952 137113600
289294898 _MASSIMO_ F Nov. 1, 2024, 5:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 52 2999 126566400
289295065 bnmanubharadwaj F Nov. 1, 2024, 5:41 p.m. OK Node.js TESTS 52 999 137216000
289293585 AkiLotus F Nov. 1, 2024, 5:33 p.m. OK Python 3 TESTS 52 1280 162508800

remove filters

Back to search problems