Codeforces Round 1124 (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
2268 Codeforces Round 1124 (Div. 1) FINISHED False 9000 746666 Sept. 26, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5543 ) B What a SauSaGe! It's All Meat PROGRAMMING bitmasks math

In SauSaGe City, there are (n) different flavors of sausages. Reyhaneh, the Queen of SauSaGe City, keeps (a_i) ((a_i \lt 16)) sausages of flavor (i) in the royal warehouse. Over time, the royal inventory undergoes (q) updates. Each update is given in the form ((p, x)), which means the number of sausages of flavor (p) in the warehouse is changed to (x) (i.e., (a_p := x)). Reyhaneh can perform the following operation on the sausages any number of times (possibly zero): Choose an index (1 \leq i \lt n) and an integer (1 \leq k \leq 5), then replace (a_i) and (a_{i+1}) with (a_i \oplus (3 \cdot k)) and (a_{i+1} \oplus (3 \cdot k)), respectively, where (\oplus) denotes the bitwise XOR . In SauSaGe City, a sausage flavor is called All-Meat if its quantity is divisible by (3). Three famous sausage critics — Shafi, Shafaghi, and Ghaffari — only like flavors that are All-Meat. Before processing any updates, and after each of the (q) updates, you need to answer the following question: If Reyhaneh performs an arbitrary number of operations optimally, what is the maximum possible number of sausage flavors that the three critics would like? Note: The operations you perform to find the answer for each state are hypothetical and do not affect the array for subsequent queries. However, the (q) inventory updates ((a_p := x)) are permanent. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((2 \leq n \leq 2 \cdot 10^5), (0 \leq q \leq 2 \cdot 10^5)) — the number of sausage flavors and the number of updates, respectively. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((0 \leq a_i \lt 16)) — the initial numbers of sausages of each flavor. Then (q) lines follow, each cont

Tutorials

157140

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392191644 albertwangwm B Sept. 26, 2026, 3 p.m. OK C++17 (GCC 7-32) TESTS 15 140 0
392288572 Flechazo1314 B Sept. 27, 2026, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392259465 GregCodez B Sept. 26, 2026, 11:16 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392255122 devecent B Sept. 26, 2026, 9:02 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392244841 Boringpizza B Sept. 26, 2026, 6:35 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392207581 mo0dman B Sept. 26, 2026, 3:35 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392194555 chen_weilian B Sept. 26, 2026, 3:06 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392189796 intjr B Sept. 26, 2026, 2:56 p.m. OK C++17 (GCC 7-32) TESTS 15 156 0
392203589 kaathe B Sept. 26, 2026, 3:26 p.m. OK C++17 (GCC 7-32) TESTS 15 156 819200
392200657 hoangminhnhat B Sept. 26, 2026, 3:19 p.m. OK C++17 (GCC 7-32) TESTS 15 156 819200
392190535 shiomusubi496 B Sept. 26, 2026, 2:58 p.m. OK C++20 (GCC 13-64) TESTS 15 62 307200
392195073 lyt-715 B Sept. 26, 2026, 3:07 p.m. OK C++20 (GCC 13-64) TESTS 15 62 614400
392185852 Elysion B Sept. 26, 2026, 2:49 p.m. OK C++20 (GCC 13-64) TESTS 15 93 21299200
392188255 fydj B Sept. 26, 2026, 2:54 p.m. OK C++20 (GCC 13-64) TESTS 15 109 2867200
392192372 BiouX B Sept. 26, 2026, 3:01 p.m. OK C++20 (GCC 13-64) TESTS 15 109 12083200
392278572 master_luo B Sept. 27, 2026, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 15 125 0
392262730 Tan_Le_Jie B Sept. 27, 2026, 1:16 a.m. OK C++20 (GCC 13-64) TESTS 15 125 0
392257830 Daksh2311 B Sept. 26, 2026, 10:15 p.m. OK C++20 (GCC 13-64) TESTS 15 125 0
392250922 timusmanovs B Sept. 26, 2026, 7:52 p.m. OK C++20 (GCC 13-64) TESTS 15 125 0
392200672 mahiro_zcy B Sept. 26, 2026, 3:19 p.m. OK C++20 (GCC 13-64) TESTS 15 125 0
392192663 yosupo B Sept. 26, 2026, 3:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 102400
392186429 arvindf232 B Sept. 26, 2026, 2:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 1126400
392180029 hodza B Sept. 26, 2026, 2:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 2150400
392192900 Sulfox B Sept. 26, 2026, 3:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 3993600
392187413 b6e0 B Sept. 26, 2026, 2:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 6144000
392195255 Ruliea_ B Sept. 26, 2026, 3:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 62 10137600
392186617 gunuozhang B Sept. 26, 2026, 2:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 78 102400
392190181 permutation B Sept. 26, 2026, 2:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 93 0
392198678 Pt.ll B Sept. 26, 2026, 3:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 93 3174400
392190498 -nameless- B Sept. 26, 2026, 2:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 109 819200
392191323 Gassa B Sept. 26, 2026, 2:59 p.m. OK D TESTS 15 328 3174400
392191532 Cybuster B Sept. 26, 2026, 3 p.m. OK D TESTS 15 421 2867200
392194831 WaterBottlle B Sept. 26, 2026, 3:06 p.m. OK Java 21 TESTS 15 250 1126400
392188982 LT1 B Sept. 26, 2026, 2:55 p.m. OK Java 21 TESTS 15 406 921600
392206618 hardiknarang2509 B Sept. 26, 2026, 3:33 p.m. OK Java 21 TESTS 15 421 2048000
392201660 MaxBuzz B Sept. 26, 2026, 3:21 p.m. OK Java 21 TESTS 15 437 819200
392195459 AJ123496 B Sept. 26, 2026, 3:08 p.m. OK Java 21 TESTS 15 1031 1126400
392198667 aaryannage.dev B Sept. 26, 2026, 3:14 p.m. OK Java 21 TESTS 15 1062 20582400
392238935 aditya_sah_11 B Sept. 26, 2026, 5:42 p.m. OK Java 21 TESTS 15 1390 82944000
392223196 dark_slayer007 B Sept. 26, 2026, 4:22 p.m. OK Java 8 TESTS 15 156 3174400
392196572 malachi_toney_goat B Sept. 26, 2026, 3:10 p.m. OK Java 8 TESTS 15 265 4198400
392194546 Tlatoani B Sept. 26, 2026, 3:06 p.m. OK Kotlin 2.2 TESTS 15 375 3788800
392195482 DeadRhino B Sept. 26, 2026, 3:08 p.m. OK PyPy 3 TESTS 15 578 20889600
392186730 harurun4635 B Sept. 26, 2026, 2:51 p.m. OK PyPy 3-64 TESTS 15 203 21401600
392199922 chhillarankit74 B Sept. 26, 2026, 3:17 p.m. OK PyPy 3-64 TESTS 15 218 54886400
392188971 x0rque B Sept. 26, 2026, 2:55 p.m. OK PyPy 3-64 TESTS 15 250 25497600
392187072 _______________________ B Sept. 26, 2026, 2:52 p.m. OK PyPy 3-64 TESTS 15 250 26726400
392193823 Haire B Sept. 26, 2026, 3:04 p.m. OK PyPy 3-64 TESTS 15 265 21606400
392189599 stan23456 B Sept. 26, 2026, 2:56 p.m. OK PyPy 3-64 TESTS 15 265 22732800
392189900 lunyi B Sept. 26, 2026, 2:57 p.m. OK PyPy 3-64 TESTS 15 265 22937600
392263947 Little_Sheep_Yawn B Sept. 27, 2026, 1:41 a.m. OK PyPy 3-64 TESTS 15 265 28467200
392203184 glebisbusy B Sept. 26, 2026, 3:25 p.m. OK PyPy 3-64 TESTS 15 265 58163200
392189320 Kuro_neko B Sept. 26, 2026, 2:55 p.m. OK PyPy 3-64 TESTS 15 281 25088000
392208820 Jimanbanashi B Sept. 26, 2026, 3:39 p.m. OK Python 2 TESTS 15 593 11980800
392260808 jorgevmg31 B Sept. 27, 2026, 12:11 a.m. OK Python 3 TESTS 15 437 9523200
392255275 nushuli B Sept. 26, 2026, 9:04 p.m. OK Python 3 TESTS 15 609 32256000
392198216 cvs-650 B Sept. 26, 2026, 3:13 p.m. OK Rust 2024 TESTS 15 62 5222400
392200184 darkkcyan B Sept. 26, 2026, 3:18 p.m. OK Rust 2024 TESTS 15 78 0
392201512 Kevin-27 B Sept. 26, 2026, 3:21 p.m. OK Rust 2024 TESTS 15 78 3379200
392196589 DanielAnker B Sept. 26, 2026, 3:10 p.m. OK Rust 2024 TESTS 15 796 1740800
392197221 qwerty787788 B Sept. 26, 2026, 3:11 p.m. OK Rust 2024 TESTS 15 1218 134246400

remove filters

Back to search problems