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 |
---|---|---|---|---|---|---|
1991 | Pinely Round 4 (Div. 1 + Div. 2) | FINISHED | False | 10800 | 9645899 | July 28, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 611 ) | G | Grid Reset | PROGRAMMING | constructive algorithms greedy |
B'You are given a grid consisting of n rows and m columns, where each cell is initially white. Additionally, you are given an integer k , where 1 <= k <= min(n, m) . You will process q operations of two types: After each operation, if any rows or columns become completely black, all cells in these rows and columns are simultaneously reset to white. Specifically, if all cells in the row and column a cell is contained in become black, all cells in both the row and column will be reset to white. Choose the rectangles in a way that you can perform all given operations, or determine that it is impossible. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains four integers n , m , k , and q ( 1 <= n, m <= 100 , 1 <= k <= min(n, m) , 1 <= q <= 1000 ) -- the number of rows and columns in the grid, the size of the operation rectangle, and the number of operations, respectively. The second line of each test case contains a string s of length q , consisting only of characters mathtt{H} and mathtt{V} -- the sequence of operation types. It is guaranteed that the sum of q over all test cases does not exceed 1000 . For each test case, output a single integer -1 if it is impossible to perform all the operations. Otherwise, output q lines. Each line contains two integers i , j ( 1 <= i <= n , 1 <= j <= m ) -- the coordinates of the top-left cell of the operation rectangle. If there are multiple solutions, output any of them. The first operation is horizontal. The operation rectangle starts at (1,1) and is a 1 x 3 rectangle. After the operation, cells (1,1) , (1,2) , and (1,3) become black. The second operation is vertical. T'... |
Video Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
273266826 | mxj_helen | G | July 29, 2024, 2:52 a.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 61 | 204800 | ||
273249725 | keko37 | G | July 28, 2024, 10:03 p.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 62 | 102400 | ||
273267074 | mxj_helen | G | July 29, 2024, 2:55 a.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 62 | 204800 | ||
273267220 | llzer | G | July 29, 2024, 2:56 a.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 77 | 102400 | ||
273266995 | mxj_helen | G | July 29, 2024, 2:54 a.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 77 | 204800 | ||
273282261 | Yoralen | G | July 29, 2024, 5:49 a.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 77 | 4096000 | ||
273224165 | fyable | G | July 28, 2024, 5:24 p.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 77 | 19865600 | ||
273227143 | qwef_ | G | July 28, 2024, 5:31 p.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 93 | 102400 | ||
273224733 | crazy_sea | G | July 28, 2024, 5:25 p.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 108 | 8192000 | ||
273239741 | ImmortaLimit | G | July 28, 2024, 7:34 p.m. | OK | C++14 (GCC 6-32) | TESTS | 40 | 109 | 142950400 | ||
273265242 | OIerGegu1019 | G | July 29, 2024, 2:34 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 0 | ||
273258192 | aspirintimeskill | G | July 29, 2024, 1:05 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 0 | ||
273248323 | Ilya_MSU | G | July 28, 2024, 9:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 0 | ||
273246983 | ikrpprppp | G | July 28, 2024, 9:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 0 | ||
273280405 | longting | G | July 29, 2024, 5:30 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 62 | 102400 | ||
273272984 | ChanceJi | G | July 29, 2024, 4:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 77 | 0 | ||
273261280 | wzc_IOI_czw | G | July 29, 2024, 1:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 77 | 0 | ||
273235128 | torisasami | G | July 28, 2024, 6:57 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 77 | 0 | ||
273226322 | Noobish_Monk | G | July 28, 2024, 5:29 p.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 77 | 0 | ||
273256714 | xiaruize | G | July 29, 2024, 12:38 a.m. | OK | C++17 (GCC 7-32) | TESTS | 40 | 77 | 102400 | ||
273281369 | asgcd | G | July 29, 2024, 5:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273270490 | SATSKY_2024target_IGM | G | July 29, 2024, 3:34 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273258350 | Look_around | G | July 29, 2024, 1:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273253107 | kevin | G | July 28, 2024, 11:14 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273243074 | luogu_bot1 | G | July 28, 2024, 8:16 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273242168 | PinkieRabbit | G | July 28, 2024, 8:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273238725 | ProjectCF | G | July 28, 2024, 7:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 46 | 0 | ||
273270904 | SATSKY_2024target_IGM | G | July 29, 2024, 3:38 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 61 | 0 | ||
273270239 | SATSKY_2024target_IGM | G | July 29, 2024, 3:31 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 61 | 0 | ||
273269984 | umbrella-leaf | G | July 29, 2024, 3:28 a.m. | OK | C++20 (GCC 13-64) | TESTS | 40 | 61 | 0 | ||
273220361 | Gassa | G | July 28, 2024, 5:14 p.m. | OK | D | TESTS | 40 | 92 | 102400 | ||
273220837 | Tlatoani | G | July 28, 2024, 5:15 p.m. | OK | Kotlin 1.9 | TESTS | 40 | 218 | 102400 | ||
273236198 | toam | G | July 28, 2024, 7:03 p.m. | OK | PyPy 3-64 | TESTS | 40 | 296 | 9216000 | ||
273224678 | chinerist | G | July 28, 2024, 5:25 p.m. | OK | PyPy 3-64 | TESTS | 40 | 499 | 11878400 | ||
273236873 | shilpabanerjee50 | G | July 28, 2024, 7:08 p.m. | OK | Python 3 | TESTS | 40 | 702 | 409600 | ||
273226202 | toomer | G | July 28, 2024, 5:29 p.m. | OK | Rust 2021 | TESTS | 40 | 93 | 0 |
Back to search problems