Codeforces Round 767 (Div. 1)

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
1628 Codeforces Round 767 (Div. 1) FINISHED False 7200 94404263 Jan. 22, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2201 ) D2 Game on Sum (Hard Version) PROGRAMMING combinatorics dp games

B'This is the hard version of the problem. The difference is the constraints on n , m and t . You can make hacks only if all versions of the problem are solved. Alice and Bob are given the numbers n , m and k , and play a game as follows: The game has a score that Alice tries to maximize, and Bob tries to minimize. The score is initially 0 . The game consists of n turns. Each turn, Alice picks a real number from 0 to k (inclusive) which Bob either adds to or subtracts from the score of the game. But throughout the game, Bob has to choose to add at least m out of the n turns. Bob gets to know which number Alice picked before deciding whether to add or subtract the number from the score, and Alice gets to know whether Bob added or subtracted the number for the previous turn before picking the number for the current turn (except on the first turn since there was no previous turn). If Alice and Bob play optimally, what will the final score of the game be? The first line of the input contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The description of test cases follows. Each test case consists of a single line containing the three integers, n , m , and k ( 1 <= m <= n <= 10^6, 0 <= k < 10^9 + 7 ) -- the number of turns, how many of those turns Bob has to add, and the biggest number Alice can choose, respectively. It is guaranteed that the sum of n over all test cases does not exceed 10^6 . For each test case output a single integer number -- the score of the optimal game modulo 10^9 + 7 . Formally, let M = 10^9 + 7 . It can be shown that the answer can be expressed as an irreducible fraction frac{p}{q} , where p and q are integers and q not equiv 0 pmod{M} . Output the integer equal to p cdot q^{-1} bmod M . In other words, output such an integer x that 0 <= x < M an'...

Tutorials

99276

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
143715404 rainboy D2 Jan. 22, 2022, 7:45 p.m. OK GNU C11 TESTS 65 561 16076800
143699481 scli_weapon D2 Jan. 22, 2022, 4:34 p.m. OK GNU C++14 TESTS 65 124 7987200
143713465 meyi D2 Jan. 22, 2022, 7:13 p.m. OK GNU C++14 TESTS 65 124 11980800
143704935 hotwords D2 Jan. 22, 2022, 5:38 p.m. OK GNU C++14 TESTS 65 139 7987200
143732522 FluffyBunny D2 Jan. 23, 2022, 4:14 a.m. OK GNU C++14 TESTS 65 139 12083200
143683966 lzoi.win D2 Jan. 22, 2022, 3:58 p.m. OK GNU C++14 TESTS 65 139 20070400
143698933 scli_kws D2 Jan. 22, 2022, 4:33 p.m. OK GNU C++14 TESTS 65 140 7987200
143670285 feecIe6418 D2 Jan. 22, 2022, 3:30 p.m. OK GNU C++14 TESTS 65 140 11980800
143681821 ugly2333 D2 Jan. 22, 2022, 3:53 p.m. OK GNU C++14 TESTS 65 140 13414400
143692742 meyi D2 Jan. 22, 2022, 4:19 p.m. OK GNU C++14 TESTS 65 140 20070400
143691830 _Guoyh_ D2 Jan. 22, 2022, 4:17 p.m. OK GNU C++14 TESTS 65 140 24064000
143673523 izone D2 Jan. 22, 2022, 3:36 p.m. OK GNU C++17 TESTS 65 93 12492800
143693282 skywalkert D2 Jan. 22, 2022, 4:20 p.m. OK GNU C++17 TESTS 65 124 3993600
143684169 fallleaves01 D2 Jan. 22, 2022, 3:59 p.m. OK GNU C++17 TESTS 65 124 24166400
143703226 amethyst0 D2 Jan. 22, 2022, 5:28 p.m. OK GNU C++17 TESTS 65 139 12083200
143740138 _Crystalz D2 Jan. 23, 2022, 6 a.m. OK GNU C++17 TESTS 65 139 16076800
143678383 SHZhang D2 Jan. 22, 2022, 3:46 p.m. OK GNU C++17 TESTS 65 140 11980800
143691950 relyt871 D2 Jan. 22, 2022, 4:17 p.m. OK GNU C++17 TESTS 65 140 12083200
143707502 aaa2333333 D2 Jan. 22, 2022, 5:59 p.m. OK GNU C++17 TESTS 65 140 24064000
143680937 wifiii D2 Jan. 22, 2022, 3:51 p.m. OK GNU C++17 TESTS 65 155 11980800
143696287 DerekFeng D2 Jan. 22, 2022, 4:27 p.m. OK GNU C++17 TESTS 65 155 12083200
143688144 LayCurse D2 Jan. 22, 2022, 4:07 p.m. OK GNU C++17 (64) TESTS 65 31 110284800
143696331 Sakuyalove D2 Jan. 22, 2022, 4:27 p.m. OK GNU C++17 (64) TESTS 65 46 15155200
143683582 emthrm D2 Jan. 22, 2022, 3:57 p.m. OK GNU C++17 (64) TESTS 65 77 7987200
143663529 Nyaan D2 Jan. 22, 2022, 3:17 p.m. OK GNU C++17 (64) TESTS 65 77 19763200
143702759 neal D2 Jan. 22, 2022, 5:26 p.m. OK GNU C++17 (64) TESTS 65 92 12083200
143724292 Graphter D2 Jan. 23, 2022, 12:26 a.m. OK GNU C++17 (64) TESTS 65 92 24064000
143696792 mshcherba D2 Jan. 22, 2022, 4:28 p.m. OK GNU C++17 (64) TESTS 65 93 8396800
143691916 kotatsugame D2 Jan. 22, 2022, 4:17 p.m. OK GNU C++17 (64) TESTS 65 93 8806400
143666691 GSHgsh D2 Jan. 22, 2022, 3:23 p.m. OK GNU C++17 (64) TESTS 65 93 11980800
143733659 KyuusyouTheSavior D2 Jan. 23, 2022, 4:35 a.m. OK GNU C++17 (64) TESTS 65 93 11980800
143703142 maxplus D2 Jan. 22, 2022, 5:28 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143707408 maxplus D2 Jan. 22, 2022, 5:58 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143706635 maxplus D2 Jan. 22, 2022, 5:51 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143705469 maxplus D2 Jan. 22, 2022, 5:42 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143705432 maxplus D2 Jan. 22, 2022, 5:41 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143705382 maxplus D2 Jan. 22, 2022, 5:41 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143703900 maxplus D2 Jan. 22, 2022, 5:31 p.m. OK GNU C++20 (64) TESTS 65 46 12083200
143703432 maxplus D2 Jan. 22, 2022, 5:29 p.m. OK GNU C++20 (64) TESTS 65 61 12083200
143706847 maxplus D2 Jan. 22, 2022, 5:53 p.m. OK GNU C++20 (64) TESTS 65 61 12083200
143706732 maxplus D2 Jan. 22, 2022, 5:52 p.m. OK GNU C++20 (64) TESTS 65 62 12083200
143691291 clyring D2 Jan. 22, 2022, 4:15 p.m. OK Haskell TESTS 65 639 62976000
143709439 AndreySiunov D2 Jan. 22, 2022, 6:19 p.m. OK Java 11 TESTS 65 779 40448000
143707309 derrick20 D2 Jan. 22, 2022, 5:57 p.m. OK Java 11 TESTS 65 857 43929600
143696397 martins D2 Jan. 22, 2022, 4:27 p.m. OK Java 11 TESTS 65 1185 104140800
143702852 Mathematiker D2 Jan. 22, 2022, 5:26 p.m. OK Java 11 TESTS 65 1996 43622400
143724479 Ste D2 Jan. 23, 2022, 12:35 a.m. OK Java 11 TESTS 65 2947 24064000
143688461 fetetriste D2 Jan. 22, 2022, 4:08 p.m. OK Java 8 TESTS 65 296 14028800
143709422 AndreySiunov D2 Jan. 22, 2022, 6:19 p.m. OK Java 8 TESTS 65 686 38195200
143708432 golions D2 Jan. 22, 2022, 6:09 p.m. OK Java 8 TESTS 65 1060 38297600
143709166 AndreySiunov D2 Jan. 22, 2022, 6:16 p.m. OK Java 8 TESTS 65 2995 38195200
143708732 Hakiobo D2 Jan. 22, 2022, 6:12 p.m. OK Kotlin 1.4 TESTS 65 296 20377600
143693807 arvindf232 D2 Jan. 22, 2022, 4:21 p.m. OK Kotlin 1.4 TESTS 65 2355 18432000
143688644 machine_solution D2 Jan. 22, 2022, 4:09 p.m. OK MS C++ 2017 TESTS 65 1606 8192000
143727531 OLOGY D2 Jan. 23, 2022, 2:23 a.m. OK PyPy 2 TESTS 65 1575 173977600
143723070 OLOGY D2 Jan. 22, 2022, 11:21 p.m. OK PyPy 2 TESTS 65 1575 174080000
143698643 NecroSean38 D2 Jan. 22, 2022, 4:32 p.m. OK PyPy 3 TESTS 65 810 9420800
143715303 titia D2 Jan. 22, 2022, 7:43 p.m. OK PyPy 3 TESTS 65 1466 148582400
143689440 whatshisbucket D2 Jan. 22, 2022, 4:11 p.m. OK PyPy 3 TESTS 65 2433 134041600
143691671 SPD_9X2 D2 Jan. 22, 2022, 4:16 p.m. OK PyPy 3-64 TESTS 65 732 71987200
143704799 chinerist D2 Jan. 22, 2022, 5:37 p.m. OK PyPy 3-64 TESTS 65 748 56012800
143702829 r57shell D2 Jan. 22, 2022, 5:26 p.m. OK PyPy 3-64 TESTS 65 779 83763200
143710799 whatshisbucket D2 Jan. 22, 2022, 6:34 p.m. OK PyPy 3-64 TESTS 65 2074 45056000
143723445 OLOGY D2 Jan. 22, 2022, 11:40 p.m. OK Python 2 TESTS 65 2807 67379200
143724277 OLOGY D2 Jan. 23, 2022, 12:26 a.m. OK Python 2 TESTS 65 2838 67276800
143723031 OLOGY D2 Jan. 22, 2022, 11:20 p.m. OK Python 2 TESTS 65 2838 67276800
143723020 OLOGY D2 Jan. 22, 2022, 11:19 p.m. OK Python 2 TESTS 65 2885 67276800
143727584 OLOGY D2 Jan. 23, 2022, 2:25 a.m. OK Python 2 TESTS 65 2901 67379200
143705815 kobae964 D2 Jan. 22, 2022, 5:44 p.m. OK Rust 2021 TESTS 65 93 26521600
143681354 kobae964 D2 Jan. 22, 2022, 3:52 p.m. OK Rust 2021 TESTS 65 93 26726400
143676417 sansen D2 Jan. 22, 2022, 3:42 p.m. OK Rust 2021 TESTS 65 109 29593600
143686142 qwerty787788 D2 Jan. 22, 2022, 4:03 p.m. OK Rust 2021 TESTS 65 140 16076800
143687494 Egor D2 Jan. 22, 2022, 4:06 p.m. OK Rust 2021 TESTS 65 186 13312000

remove filters

Back to search problems