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 |
|---|---|---|---|---|---|---|
| 2161 | Pinely Round 5 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 14563523 | Oct. 30, 2025, 4:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 89 ) | G | Bitwise And Equals | PROGRAMMING | bitmasks |
There is an array of integers (a_1, a_2, \ldots, a_n), and there is an integer (X). You may perform the following operation zero or more times: Select (i), and increase (a_i) by one. Let (a') be the final state of the array. Your goal is to perform the operation above the smallest number of times such that (a'_1 \,\&\, a'_2 \,\&\, \ldots \,\&\, a'_n = X). (\&) denotes the bitwise AND operation . There are (q) such query integers (X): (X_1, X_2, \ldots, X_q). Compute the answer for each (X = X_i). Note that all queries are processed separately and independently, from the same initial state (a). The first line contains integers (n) and (q) ((2 \le n \le 200\,000), (1 \le q \le 200\,000)) — the length of the array and the number of queries. The second line contains integers (a_1, a_2, \ldots, a_n) (for each (i), (0 \le a_i < 2^{20})). The next (q) lines each contain a single integer (X_i) ((0 \le X_i < 2^{20})). For each query (i) out of (q), print the smallest number of operations to get to the array (a') such that (a'_1 \,\&\, a'_2 \,\&\, \ldots \,\&\, a'_n = X_i). It's possible to show, that it's always possible to obtain such array (a') in finite number of operations. For the first query, you can increase (i = 3) ((a_i = 7)) and get the array (a = 6, 4, 8, 5, 4), then (6 \,\&\, 4 \,\&\, 8 \,\&\, 5 \,\&\, 4 = 0). For the third query, original array already matches condition: (6 \,\&\, 4 \,\&\, 7 \,\&\, 5 \,\&\, 4 = 4). |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 346742090 | _MOLOTOF | G | Oct. 30, 2025, 9:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 437 | 9830400 | ||
| 346756646 | xuantien123 | G | Oct. 31, 2025, 2:31 a.m. | OK | C++17 (GCC 7-32) | TESTS | 55 | 468 | 9932800 | ||
| 346739971 | BurnedChicken | G | Oct. 30, 2025, 8:43 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 218 | 14233600 | ||
| 346738704 | ishaqsharif | G | Oct. 30, 2025, 8:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 327 | 9625600 | ||
| 346748219 | Monis_70 | G | Oct. 30, 2025, 11:14 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 1233 | 24268800 | ||
| 346718997 | tourist | G | Oct. 30, 2025, 6:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 1233 | 24268800 | ||
| 346769765 | 0wuming0 | G | Oct. 31, 2025, 5:20 a.m. | OK | C++20 (GCC 13-64) | TESTS | 55 | 2499 | 24473600 | ||
| 346743459 | hungchi17 | G | Oct. 30, 2025, 9:33 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 218 | 14233600 | ||
| 346731196 | jiangly | G | Oct. 30, 2025, 7:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 234 | 5836800 | ||
| 346725565 | ksun48 | G | Oct. 30, 2025, 6:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 374 | 9728000 | ||
| 346721533 | Kevin114514 | G | Oct. 30, 2025, 6:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 546 | 17715200 | ||
| 346732266 | Nachia | G | Oct. 30, 2025, 7:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 624 | 152678400 | ||
| 346726280 | yosupo | G | Oct. 30, 2025, 7:02 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 796 | 34713600 | ||
| 346727386 | Petr | G | Oct. 30, 2025, 7:07 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 1015 | 93798400 | ||
| 346745746 | timepass_cpp | G | Oct. 30, 2025, 10:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 1155 | 24473600 | ||
| 346739931 | ksun48 | G | Oct. 30, 2025, 8:42 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 1609 | 269414400 | ||
| 346737818 | 300iq | G | Oct. 30, 2025, 8:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 55 | 1921 | 181145600 | ||
| 346746347 | gua069 | G | Oct. 30, 2025, 10:28 p.m. | OK | Java 8 | TESTS | 55 | 343 | 15155200 |
Back to search problems