Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022

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
1726 Codeforces Round 819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 FINISHED False 8100 74791463 Sept. 6, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 330 ) G A Certain Magical Party PROGRAMMING combinatorics greedy sortings

B"There are n people at a party. The i -th person has an amount of happiness a_i . Every person has a certain kind of personality which can be represented as a binary integer b . If b = 0 , it means the happiness of the person will increase if he tells the story to someone strictly less happy than them. If b = 1 , it means the happiness of the person will increase if he tells the story to someone strictly more happy than them. Let us define a speaking order as an ordering of the people from left to right. Now the following process occurs. We go from left to right. The current person tells the story to all people other than himself. Note that all happiness values stay constant while this happens. After the person is done, he counts the number of people who currently have strictly less/more happiness than him as per his kind of personality, and his happiness increases by that value. Note that only the current person's happiness value increases. As the organizer of the party, you don't want anyone to leave sad. Therefore, you want to count the number of speaking orders such that at the end of the process all n people have equal happiness. Two speaking orders are considered different if there exists at least one person who does not have the same position in the two speaking orders. The first line contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the number of people. The second line contains a sequence of n integers a_1,a_2,...,a_n ( 1 <= q a_i <= q 2n ) -- the happiness values. The third line contains a sequence of n binary numbers b_1,b_2,...,b_n ( b_i in {0,1 } ) -- the kinds of personality. Output the number of different valid speaking orders. Since this number can be large, output it modulo 998244353 . Here is the explanation for the first example. One valid speaking order is [2,1,4,3] (here, we have written the indices of each person). Each step "...

Tutorials

Codeforces Round #819 (Div. 1 + Div. 2) and Grimoire of Code Annual Contest 2022 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
171185025 csyakuoi G Sept. 7, 2022, 2:09 a.m. OK GNU C++14 TESTS 64 109 4812800
171194004 nixnehc G Sept. 7, 2022, 5:08 a.m. OK GNU C++14 TESTS 65 124 12800000
171164608 fallleaves07 G Sept. 6, 2022, 7:08 p.m. OK GNU C++17 TESTS 64 108 2457600
171177247 Wailydest G Sept. 6, 2022, 10:55 p.m. OK GNU C++17 TESTS 64 109 6348800
171180379 inaFSTream G Sept. 7, 2022, 12:21 a.m. OK GNU C++17 TESTS 64 186 116224000
171157236 heno239 G Sept. 6, 2022, 6:04 p.m. OK GNU C++17 TESTS 64 343 28364800
171164624 Fazor52 G Sept. 6, 2022, 7:09 p.m. OK GNU C++17 TESTS 64 452 13107200
171162432 fanache99 G Sept. 6, 2022, 6:46 p.m. OK GNU C++17 TESTS 64 467 13107200
171144226 kotatsugame G Sept. 6, 2022, 4:34 p.m. OK GNU C++17 (64) TESTS 63 77 8908800
171159644 ilulu G Sept. 6, 2022, 6:22 p.m. OK GNU C++17 (64) TESTS 64 77 16793600
171186613 AoLiGei G Sept. 7, 2022, 2:44 a.m. OK GNU C++17 (64) TESTS 65 78 3993600
171195293 foreverlasting G Sept. 7, 2022, 5:30 a.m. OK GNU C++17 (64) TESTS 65 109 54681600
171156072 hitonanode G Sept. 6, 2022, 5:56 p.m. OK GNU C++17 (64) TESTS 64 124 22118400
171155324 BalintR G Sept. 6, 2022, 5:52 p.m. OK GNU C++20 (64) TESTS 64 62 4812800
171184061 mhq G Sept. 7, 2022, 1:49 a.m. OK GNU C++20 (64) TESTS 64 62 19251200
171167204 cookiedoth G Sept. 6, 2022, 7:38 p.m. OK GNU C++20 (64) TESTS 64 77 9932800
171189781 Chenyu_Qiu G Sept. 7, 2022, 3:52 a.m. OK GNU C++20 (64) TESTS 65 78 13107200
171156663 Endagorion G Sept. 6, 2022, 6 p.m. OK GNU C++20 (64) TESTS 64 78 18841600
171145348 tatyam G Sept. 6, 2022, 4:37 p.m. OK GNU C++20 (64) TESTS 63 109 17305600
171158116 turmax G Sept. 6, 2022, 6:10 p.m. OK GNU C++20 (64) TESTS 64 109 22528000
171157860 turmax G Sept. 6, 2022, 6:09 p.m. OK GNU C++20 (64) TESTS 64 109 22528000
171157000 turmax G Sept. 6, 2022, 6:02 p.m. OK GNU C++20 (64) TESTS 64 109 22528000
171170680 maroonrk G Sept. 6, 2022, 8:29 p.m. OK GNU C++20 (64) TESTS 64 109 45260800

remove filters

Back to search problems