Codeforces Round 1074 (Div. 4)

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
2185 Codeforces Round 1074 (Div. 4) FINISHED False 8100 7658723 Jan. 18, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4934 ) F BattleCows PROGRAMMING data structures divide and conquer implementation

Farmer John is sending a cow to compete in the International Bovine Olympiad, but he's too lazy to write problems for a contest, so he does the next most reasonable thing: a fighting tournament! Farmer John has (2^n) cows standing in a line, with the (i)-th cow having a skill level of (a_i). Each cow starts in a stack containing only itself, and the skill level of the stack is equal to the XOR-sum(^{\text{∗}}) of the skill levels of all the cows in it. For example, if the stack consists of cows (1, 3, 9) from bottom to top, then the skill level of the stack is (1 \oplus 3 \oplus 9 = 11). The following process repeats until there is only one stack. Every stack in an odd position ((1)st, (3)rd, etc.) starts a fight with the stack to its right. For example, the (1)st stack will fight with the (2)nd stack, the (3)rd stack will fight with the (4)th stack, etc. The stack with the higher skill level will win the match, with the left-most stack winning in case of a tie. The winning stack will jump on top of the losing stack and shift itself over such that there are no gaps left by the defeated stacks. In order to make this more exciting, Farmer John created (q) potions, such that the (i)-th potion sets the skill level of the cow who drinks it to (c_i). Farmer John wants to test his potions on the cows, and so he gives the (i)-th potion to cow (b_i) and then runs the tournament. For each trial, Farmer John wants to know how many cows are above the cow that was given the potion in the final stack. Farmer John's potions wear off quickly, so when the tournament ends, the cow that was given the potion will have its skill level return to what it originally was . In other words, all queries are independent. (^{\text{∗}})The XOR-sum of an array (x_1, x_2, \ldots, x_y) is equal to (x_1 \oplus x_2 \oplus x_3 \ldots x_{y-1} \oplus x_y) where (\oplus) denotes the bitwise XOR operation . The fi

Tutorials

Codeforces Round 1074 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
358632807 IHEBCYBER F Jan. 18, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 8 171 4198400
358667675 lambiguinho F Jan. 19, 2026, 1:40 a.m. OK C++17 (GCC 7-32) TESTS 8 203 0
358639001 EduardoBelian F Jan. 18, 2026, 5:09 p.m. OK C++17 (GCC 7-32) TESTS 8 203 0
358629109 WeakBlood F Jan. 18, 2026, 4:41 p.m. OK C++17 (GCC 7-32) TESTS 8 203 0
358636420 C0mm4nd3rX F Jan. 18, 2026, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 8 203 0
358636182 LA611 F Jan. 18, 2026, 4:53 p.m. OK C++17 (GCC 7-32) TESTS 8 203 0
358632619 sujit02 F Jan. 18, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 8 203 307200
358671580 pete2011006 F Jan. 19, 2026, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 8 203 2150400
358629154 Sakura.Lu F Jan. 18, 2026, 4:41 p.m. OK C++17 (GCC 7-32) TESTS 8 203 2457600
358632458 DREAM_GOOGLE F Jan. 18, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 8 203 3174400
358678612 Ruizhu F Jan. 19, 2026, 4:44 a.m. OK C++20 (GCC 13-64) TESTS 8 93 4505600
358647681 JoyBoy. F Jan. 18, 2026, 6:16 p.m. OK C++20 (GCC 13-64) TESTS 8 156 2457600
358650656 nipu_das F Jan. 18, 2026, 6:45 p.m. OK C++20 (GCC 13-64) TESTS 8 156 2457600
358666137 k720 F Jan. 19, 2026, 12:54 a.m. OK C++20 (GCC 13-64) TESTS 8 156 4300800
358646812 mansur.maksut28 F Jan. 18, 2026, 6:07 p.m. OK C++20 (GCC 13-64) TESTS 8 171 0
358634014 dota2_player F Jan. 18, 2026, 4:48 p.m. OK C++20 (GCC 13-64) TESTS 8 171 0
358635577 chikiak49 F Jan. 18, 2026, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 8 171 307200
358661897 sky_33 F Jan. 18, 2026, 10:03 p.m. OK C++20 (GCC 13-64) TESTS 8 171 307200
358651295 pranavsingh0111 F Jan. 18, 2026, 6:53 p.m. OK C++20 (GCC 13-64) TESTS 8 171 307200
358631501 lavesh19 F Jan. 18, 2026, 4:44 p.m. OK C++20 (GCC 13-64) TESTS 8 171 307200
358634057 Darshanraj F Jan. 18, 2026, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 109 1638400
358676811 Faraz F Jan. 19, 2026, 4:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 8 140 0
358651610 _Raspberry_ F Jan. 18, 2026, 6:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 156 0
358658201 Golovanov399 F Jan. 18, 2026, 8:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 156 0
358632788 Aedityaa F Jan. 18, 2026, 4:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 156 0
358661245 Dell_Know F Jan. 18, 2026, 9:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 156 102400
358685185 Darsh_Jain F Jan. 19, 2026, 5:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 8 156 409600
358672125 big-mktx F Jan. 19, 2026, 3:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 8 171 0
358676195 radhekrishn04 F Jan. 19, 2026, 4:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 8 171 0
358662395 wakaka F Jan. 18, 2026, 10:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 8 171 0
358634398 hollow_knight_27 F Jan. 18, 2026, 4:48 p.m. OK C# 8 TESTS 8 453 37990400
358662339 NenadDapic F Jan. 18, 2026, 10:18 p.m. OK FPC TESTS 8 250 3276800
358657907 1435730 F Jan. 18, 2026, 8:30 p.m. OK GNU C11 TESTS 8 187 19865600
358628600 Satyasarthi F Jan. 18, 2026, 4:40 p.m. OK Java 21 TESTS 8 500 10342400
358630598 pranp_24 F Jan. 18, 2026, 4:43 p.m. OK Java 21 TESTS 8 546 5324800
358684838 vaambival F Jan. 19, 2026, 5:51 a.m. OK Java 21 TESTS 8 562 5939200
358635353 EVILBUSTER F Jan. 18, 2026, 4:49 p.m. OK Java 21 TESTS 8 578 10854400
358629561 punitpunde F Jan. 18, 2026, 4:42 p.m. OK Java 21 TESTS 8 593 5734400
358666499 mastacoda F Jan. 19, 2026, 1:06 a.m. OK Java 21 TESTS 8 687 20582400
358634125 George_Conqueror F Jan. 18, 2026, 4:48 p.m. OK Java 21 TESTS 8 750 12595200
358679957 Azad_Singh F Jan. 19, 2026, 5:01 a.m. OK Java 21 TESTS 8 765 25088000
358680253 Azad_Singh F Jan. 19, 2026, 5:04 a.m. OK Java 21 TESTS 8 781 5734400
358630529 George_Conqueror F Jan. 18, 2026, 4:43 p.m. OK Java 21 TESTS 8 875 13209600
358635562 Siddardha__reddy F Jan. 18, 2026, 4:49 p.m. OK Java 8 TESTS 8 1640 10342400
358630810 ked4ma F Jan. 18, 2026, 4:43 p.m. OK Kotlin 2.2 TESTS 8 1468 37171200
358632879 saikatmondal2105 F Jan. 18, 2026, 4:46 p.m. OK Node.js TESTS 8 234 45363200
358628754 DSY23 F Jan. 18, 2026, 4:41 p.m. OK PyPy 3 TESTS 8 1031 45772800
358640169 quantiset F Jan. 18, 2026, 5:16 p.m. OK PyPy 3 TESTS 8 1593 21913600
358637358 Simplixity F Jan. 18, 2026, 4:59 p.m. OK PyPy 3 TESTS 8 1781 31948800
358673420 shxd1k F Jan. 19, 2026, 3:25 a.m. OK PyPy 3 TESTS 8 1984 21504000
358656815 gardengnome F Jan. 18, 2026, 8:11 p.m. OK PyPy 3-64 TESTS 8 265 35737600
358671371 Mula_Wang F Jan. 19, 2026, 2:53 a.m. OK PyPy 3-64 TESTS 8 281 39731200
358657641 kaushik.atla F Jan. 18, 2026, 8:25 p.m. OK PyPy 3-64 TESTS 8 328 80486400
358667211 fatalerror F Jan. 19, 2026, 1:27 a.m. OK PyPy 3-64 TESTS 8 343 39424000
358636723 Aura328 F Jan. 18, 2026, 4:56 p.m. OK PyPy 3-64 TESTS 8 359 30924800
358632764 dream-world-coder F Jan. 18, 2026, 4:46 p.m. OK PyPy 3-64 TESTS 8 406 42496000
358683344 IcyGirl F Jan. 19, 2026, 5:36 a.m. OK PyPy 3-64 TESTS 8 437 54374400
358663733 GeeTransit F Jan. 18, 2026, 11:11 p.m. OK PyPy 3-64 TESTS 8 453 42496000
358637677 lgrandco F Jan. 18, 2026, 5:01 p.m. OK PyPy 3-64 TESTS 8 515 58060800
358684340 krism F Jan. 19, 2026, 5:46 a.m. OK PyPy 3-64 TESTS 8 531 42393600
358678188 Ne_xt_ F Jan. 19, 2026, 4:38 a.m. OK Python 3 TESTS 8 1328 39424000
358633162 -0.10 F Jan. 18, 2026, 4:47 p.m. OK Python 3 TESTS 8 1718 87449600
358639958 iamthe_orm F Jan. 18, 2026, 5:15 p.m. OK Python 3 TESTS 8 1953 82944000
358680746 Spheniscine F Jan. 19, 2026, 5:10 a.m. OK Rust 2021 TESTS 8 250 2457600
358635758 drvikas2004 F Jan. 18, 2026, 4:49 p.m. OK Rust 2024 TESTS 8 109 11878400

remove filters

Back to search problems