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 |
|---|---|---|---|---|---|---|
| 2223 | Codeforces Round 1097 (Div. 1, Based on Zhili Cup 2026) | FINISHED | False | 9000 | 2418896 | May 6, 2026, 6:05 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 3009 ) | B | Zhily and Barknights | PROGRAMMING | binary search data structures dp math sortings two pointers |
Zhily developed a game called Barknights, and she is preparing to release a major update on March (25). Specifically, she plans to add a Module to each Operator in the game, multiplying their power level by the Module's power. After the update is released, the famous game streamer Jily will evaluate the Operators' power levels and rank them in a tier list. Whenever an earlier-released Operator is ranked higher than a later-released Operator, it will cause a wave of drama. Unfortunately, Zhily accidentally knocked over a hot water kettle and broke her computer, which caused all the Modules to be randomly rearranged. Now Zhily wants to know the expected number of waves of drama that will be generated, but since she has to move on to the next problem, she has entrusted this task to you. You are given two arrays (a) and (b) of (n) positive integers. Let (b') be a permutation of array (b) chosen uniformly at random among all (n!) possible permutations. Define (c_i = a_i \cdot b'_i) for (1\le i \le n). Find the expected number of inversions(^{\text{∗}}) of array (c). (^{\text{∗}})An inversion in array (c) is a pair of indices ((i, j)) such that (1 \le i \lt j \le n) and (c_i \gt c_j). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 2000)) — the length of the arrays (a) and (b). The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the array (a). The third line of each test case contains (n) integers (b_1, b_2, \ldots, b_n) ((1 \le b_i \le 10^9)) — the array (b). It is guaranteed that the sum of (n) over all test cases does not exceed (2000). For each test case, output the expected number of inversions i |
| Codeforces Round 1097 (Div. 1, Div2, Based on Zhili Cup 2026) Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 373667954 | caffeine2ac | B | May 6, 2026, 6:49 a.m. | OK | C# 13 | TESTS | 6 | 3921 | 48537600 | ||
| 373666826 | Watersphere | B | May 6, 2026, 6:46 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 531 | 64204800 | ||
| 373659480 | cdlake | B | May 6, 2026, 6:24 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 578 | 64819200 | ||
| 373669827 | yes__NT | B | May 6, 2026, 6:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 609 | 64307200 | ||
| 373670226 | NalgArns | B | May 6, 2026, 6:57 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 734 | 97075200 | ||
| 373669507 | Nitter | B | May 6, 2026, 6:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 750 | 96972800 | ||
| 373701516 | Ericwan_ | B | May 6, 2026, 10:09 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 859 | 96972800 | ||
| 373657642 | DeaphetS | B | May 6, 2026, 6:19 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 1031 | 54886400 | ||
| 373662603 | Utena | B | May 6, 2026, 6:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 1187 | 128307200 | ||
| 373676602 | sbt214 | B | May 6, 2026, 7:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 1203 | 92262400 | ||
| 373657173 | lnw143 | B | May 6, 2026, 6:18 a.m. | OK | C++17 (GCC 7-32) | TESTS | 6 | 1218 | 32256000 | ||
| 373664189 | Dindin | B | May 6, 2026, 6:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 375 | 60211200 | ||
| 373664426 | wuyuetong | B | May 6, 2026, 6:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 437 | 65024000 | ||
| 373671656 | Zicrus | B | May 6, 2026, 7:02 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 437 | 97792000 | ||
| 373657231 | wangzirui123 | B | May 6, 2026, 6:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 468 | 64819200 | ||
| 373704490 | untouchable | B | May 6, 2026, 10:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 515 | 60211200 | ||
| 373667654 | cqbzlwz | B | May 6, 2026, 6:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 515 | 64512000 | ||
| 373665655 | wabca | B | May 6, 2026, 6:42 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 515 | 98099200 | ||
| 373678866 | hexahydride | B | May 6, 2026, 7:32 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 562 | 62259200 | ||
| 373671027 | Lucky-Xiang | B | May 6, 2026, 7 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 562 | 64819200 | ||
| 373666147 | flowing_boat | B | May 6, 2026, 6:44 a.m. | OK | C++20 (GCC 13-64) | TESTS | 6 | 562 | 97996800 | ||
| 373721585 | lalitt | B | May 6, 2026, 1:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 328 | 60313600 | ||
| 373662371 | va1bh3v | B | May 6, 2026, 6:32 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 359 | 60313600 | ||
| 373659362 | kyklos | B | May 6, 2026, 6:24 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 375 | 60313600 | ||
| 373661305 | gunuozhang | B | May 6, 2026, 6:29 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 375 | 60518400 | ||
| 373655943 | codingforenjoy | B | May 6, 2026, 6:15 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 421 | 64102400 | ||
| 373664049 | baodat | B | May 6, 2026, 6:37 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 453 | 98099200 | ||
| 373677369 | diss_quack | B | May 6, 2026, 7:25 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 468 | 0 | ||
| 373655908 | BurnedChicken | B | May 6, 2026, 6:15 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 500 | 81715200 | ||
| 373663124 | vegemite | B | May 6, 2026, 6:34 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 500 | 98099200 | ||
| 373660122 | orange_man | B | May 6, 2026, 6:26 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 6 | 515 | 60416000 | ||
| 373673288 | codecrasher_ | B | May 6, 2026, 7:08 a.m. | OK | Go | TESTS | 6 | 1734 | 64512000 | ||
| 373697656 | mctikhapaneer | B | May 6, 2026, 9:27 a.m. | OK | Java 21 | TESTS | 6 | 1734 | 218931200 | ||
| 373658675 | gofrozen21 | B | May 6, 2026, 6:22 a.m. | OK | Java 21 | TESTS | 6 | 2000 | 92262400 | ||
| 373664991 | MBBN | B | May 6, 2026, 6:40 a.m. | OK | Java 21 | TESTS | 6 | 4000 | 114176000 | ||
| 373677177 | hardgonnapass | B | May 6, 2026, 7:24 a.m. | OK | Java 8 | TESTS | 6 | 921 | 87654400 | ||
| 373737578 | rkr21381 | B | May 6, 2026, 3:28 p.m. | OK | Java 8 | TESTS | 6 | 2328 | 39014400 | ||
| 373687412 | bitplease_ | B | May 6, 2026, 8:14 a.m. | OK | Node.js | TESTS | 6 | 3453 | 84377600 | ||
| 373754040 | NOK | B | May 6, 2026, 6:11 p.m. | OK | PyPy 3-64 | TESTS | 6 | 1156 | 138547200 | ||
| 373667196 | Only365 | B | May 6, 2026, 6:47 a.m. | OK | PyPy 3-64 | TESTS | 6 | 1187 | 215552000 | ||
| 373700448 | fatalerror | B | May 6, 2026, 9:59 a.m. | OK | PyPy 3-64 | TESTS | 6 | 1687 | 137318400 | ||
| 373700922 | fatalerror | B | May 6, 2026, 10:03 a.m. | OK | PyPy 3-64 | TESTS | 6 | 1984 | 136294400 | ||
| 373753277 | DeadMan69 | B | May 6, 2026, 6:03 p.m. | OK | PyPy 3-64 | TESTS | 6 | 2265 | 189030400 | ||
| 373776300 | chmpro | B | May 7, 2026, 3:29 a.m. | OK | PyPy 3-64 | TESTS | 6 | 3171 | 9625600 | ||
| 373655853 | sansen | B | May 6, 2026, 6:15 a.m. | OK | Rust 2021 | TESTS | 6 | 1171 | 300339200 | ||
| 373731552 | Spheniscine | B | May 6, 2026, 2:38 p.m. | OK | Rust 2024 | TESTS | 6 | 1187 | 92364800 | ||
| 373731479 | Spheniscine | B | May 6, 2026, 2:38 p.m. | OK | Rust 2024 | TESTS | 6 | 1343 | 103116800 | ||
| 373660184 | DanielAnker | B | May 6, 2026, 6:26 a.m. | OK | Rust 2024 | TESTS | 6 | 1812 | 97996800 | ||
| 373654840 | Egor | B | May 6, 2026, 6:13 a.m. | OK | Rust 2024 | TESTS | 6 | 2312 | 104243200 |
Back to search problems