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 |
---|---|---|---|---|---|---|
1146 | Forethought Future Cup - Elimination Round | FINISHED | False | 9000 | 181655687 | April 20, 2019, 6:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 864 ) | G | Zoning Restrictions | PROGRAMMING | dp flows graphs | 2600 |
B"You are planning to build housing on a street. There are n spots available on the street on which you can build a house. The spots are labeled from 1 to n from left to right. In each spot, you can build a house with an integer height between 0 and h . In each spot, if a house has height a , you can gain a^2 dollars from it. The city has m zoning restrictions though. The i -th restriction says that if the tallest house from spots l_i to r_i is strictly more than x_i , you must pay a fine of c_i . You would like to build houses to maximize your profit (sum of dollars gained minus fines). Determine the maximum profit possible. The first line contains three integers n,h,m ( 1 <= q n,h,m <= q 50 ) -- the number of spots, the maximum height, and the number of restrictions, respectively. Each of the next m lines contains four integers l_i, r_i, x_i, c_i ( 1 <= q l_i <= q r_i <= q n , 0 <= q x_i <= q h , 1 <= q c_i <= q 5 ,000 ). Print a single integer denoting the maximum profit you can make. In the first example, it's optimal to build houses with heights [1, 3, 2] . We get a gain of 1^2+3^2+2^2 = 14 . We don't violate any restrictions, so there are no fees, so the total profit is 14 - 0 = 14 . In the second example, it's optimal to build houses with heights [10, 8, 8, 10] . We get a gain of 10^2+8^2+8^2+10^2 = 328 , and we violate the second restriction for a fee of 39 , thus the total profit is 328-39 = 289 . Note that even though there isn't a restriction on building 1 , we must still limit its height to be at most 10 . "... |
66639 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
53068121 | hos.lyric | G | April 20, 2019, 7:08 p.m. | OK | D | TESTS | 69 | 31 | 4198400 | 2600 | |
53114481 | PinkRabbit | G | April 22, 2019, 6:52 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 102400 | 2600 | |
53126050 | PinkRabbit | G | April 22, 2019, 2:04 p.m. | OK | GNU C++11 | TESTS | 69 | 31 | 102400 | 2600 | |
53429415 | CQUzbx | G | April 27, 2019, 3:24 p.m. | OK | GNU C++11 | TESTS | 69 | 31 | 204800 | 2600 | |
54176894 | Miracle_2001 | G | May 15, 2019, 2:13 p.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
53311137 | Gloid | G | April 26, 2019, 6:53 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
54056384 | Miracle_2001 | G | May 13, 2019, 8:32 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
64349988 | tender_green | G | Nov. 6, 2019, 7:56 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
54218953 | Miracle_2001 | G | May 16, 2019, 1:36 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
54217584 | Miracle_2001 | G | May 15, 2019, 11:50 p.m. | OK | GNU C++11 | TESTS | 69 | 31 | 307200 | 2600 | |
60527406 | _twilight | G | Sept. 14, 2019, 10:57 a.m. | OK | GNU C++11 | TESTS | 69 | 31 | 409600 | 2600 | |
55610357 | ReaLNero1 | G | June 16, 2019, 5:17 a.m. | OK | GNU C++14 | TESTS | 69 | 30 | 307200 | 2600 | |
53123674 | krijgertje | G | April 22, 2019, 12:44 p.m. | OK | GNU C++14 | TESTS | 69 | 30 | 307200 | 2600 | |
53194758 | iaNTU | G | April 23, 2019, 2:39 p.m. | OK | GNU C++14 | TESTS | 69 | 30 | 1740800 | 2600 | |
54092866 | Holland_Pig | G | May 14, 2019, 11:42 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 307200 | 2600 | |
53174489 | zsyzsy | G | April 23, 2019, 2:21 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 307200 | 2600 | |
64201516 | Verly | G | Nov. 4, 2019, 11:37 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 409600 | 2600 | |
68162609 | StayAwayFromBitches | G | Jan. 4, 2020, 11:32 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 409600 | 2600 | |
68161884 | StayAwayFromBitches | G | Jan. 4, 2020, 11:14 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 409600 | 2600 | |
68161856 | StayAwayFromBitches | G | Jan. 4, 2020, 11:14 a.m. | OK | GNU C++14 | TESTS | 69 | 31 | 409600 | 2600 | |
64523479 | MagicSpark | G | Nov. 8, 2019, 1:02 p.m. | OK | GNU C++14 | TESTS | 69 | 31 | 409600 | 2600 | |
53839113 | Trote_w | G | May 7, 2019, 6:08 a.m. | OK | GNU C++17 | TESTS | 69 | 30 | 409600 | 2600 | |
53066997 | ei133333 | G | April 20, 2019, 6:58 p.m. | OK | GNU C++17 | TESTS | 69 | 30 | 716800 | 2600 | |
53599217 | mu_xia_xiu_ji | G | May 1, 2019, 6:37 a.m. | OK | GNU C++17 | TESTS | 69 | 30 | 19660800 | 2600 | |
53220364 | KrK | G | April 24, 2019, 11:32 a.m. | OK | GNU C++17 | TESTS | 69 | 31 | 0 | 2600 | |
53203510 | HIT_TOM | G | April 23, 2019, 7:28 p.m. | OK | GNU C++17 | TESTS | 69 | 31 | 204800 | 2600 | |
54427128 | phan_trinh | G | May 20, 2019, 7:13 p.m. | OK | GNU C++17 | TESTS | 69 | 31 | 204800 | 2600 | |
53092194 | nikolapesic2802 | G | April 21, 2019, 11:46 a.m. | OK | GNU C++17 | TESTS | 69 | 31 | 409600 | 2600 | |
53603806 | CMXRYNP | G | May 1, 2019, 9:14 a.m. | OK | GNU C++17 | TESTS | 69 | 31 | 409600 | 2600 | |
53105053 | neal | G | April 21, 2019, 7:12 p.m. | OK | GNU C++17 | TESTS | 69 | 31 | 409600 | 2600 | |
53099421 | pmnox | G | April 21, 2019, 3:29 p.m. | OK | GNU C++17 | TESTS | 69 | 31 | 409600 | 2600 | |
55002151 | happybelly | G | June 3, 2019, 5:18 a.m. | OK | Java 8 | TESTS | 69 | 124 | 0 | 2600 | |
53178939 | StayAwayFromBitches | G | April 23, 2019, 6:22 a.m. | OK | Java 8 | TESTS | 69 | 124 | 0 | 2600 | |
53106184 | Suzukaze | G | April 21, 2019, 8:10 p.m. | OK | Java 8 | TESTS | 69 | 139 | 0 | 2600 | |
55317341 | happybelly | G | June 9, 2019, 12:05 a.m. | OK | Java 8 | TESTS | 69 | 171 | 0 | 2600 | |
53067591 | niyaznigmatul | G | April 20, 2019, 7:03 p.m. | OK | Java 8 | TESTS | 69 | 187 | 0 | 2600 | |
55317198 | happybelly | G | June 8, 2019, 11:50 p.m. | OK | Java 8 | TESTS | 69 | 187 | 0 | 2600 | |
53662640 | zhishou | G | May 2, 2019, 8:38 a.m. | OK | Java 8 | TESTS | 69 | 202 | 191488000 | 2600 | |
54421701 | SpargelTarzan | G | May 20, 2019, 3:50 p.m. | OK | Java 8 | TESTS | 69 | 218 | 0 | 2600 | |
53724793 | dalt | G | May 4, 2019, 3:19 a.m. | OK | Java 8 | TESTS | 69 | 311 | 0 | 2600 | |
54958170 | happybelly | G | June 2, 2019, 1:49 a.m. | OK | Java 8 | TESTS | 69 | 327 | 0 | 2600 |
Back to search problems