Codeforces Round 817 (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
1722 Codeforces Round 817 (Div. 4) FINISHED False 8100 69952199 Aug. 30, 2022, 2:50 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 11014 ) E Counting Rectangles PROGRAMMING brute force data structures dp implementation 1600

B"You have n rectangles, the i -th rectangle has height h_i and width w_i . You are asked q queries of the form h_s w_s h_b w_b . For each query output, the total area of rectangles you own that can fit a rectangle of height h_s and width w_s while also fitting in a rectangle of height h_b and width w_b . In other words, print sum h_i cdot w_i for i such that h_s < h_i < h_b and w_s < w_i < w_b . Please note, that if two rectangles have the same height or the same width, then they cannot fit inside each other. Also note that you cannot rotate rectangles. Please note that the answer for some test cases won't fit into 32-bit integer type, so you should use at least 64-bit integer type in your programming language (like long long for C++). The first line of the input contains an integer t ( 1 <= q t <= q 100 ) -- the number of test cases. The first line of each test case two integers n, q ( 1 <= q n <= q 10^5 ; 1 <= q q <= q 10^5 ) -- the number of rectangles you own and the number of queries. Then n lines follow, each containing two integers h_i, w_i ( 1 <= q h_i, w_i <= q 1000 ) -- the height and width of the i -th rectangle. Then q lines follow, each containing four integers h_s, w_s, h_b, w_b ( 1 <= q h_s < h_b, w_s < w_b <= q 1000 ) -- the description of each query. The sum of q over all test cases does not exceed 10^5 , and the sum of n over all test cases does not exceed 10^5 . For each test case, output q lines, the i -th line containing the answer to the i -th query. In the first test case, there is only one query. We need to find the sum of areas of all rectangles that can fit a 1 x 1 rectangle inside of it and fit into a 3 x 4 rectangle. Only the 2 x 3 rectangle works, because 1 < 2 (comparing heights) and 1 < 3 "...

Tutorials

106478

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
170360424 sogogi E Aug. 31, 2022, 8:10 a.m. OK C# 10 TESTS 18 920 80486400 1600
170361499 orloffm E Aug. 31, 2022, 8:23 a.m. OK C# 10 TESTS 18 2027 150220800 1600
170370313 SmoothOperator E Aug. 31, 2022, 10:11 a.m. OK GNU C11 TESTS 18 1185 9932800 1600
170403071 -zse- E Aug. 31, 2022, 3:30 p.m. OK GNU C++14 TESTS 18 202 5632000 1600
170380205 AkaiLemon E Aug. 31, 2022, 11:50 a.m. OK GNU C++14 TESTS 18 217 8806400 1600
170435154 GMXH E Sept. 1, 2022, 1:08 a.m. OK GNU C++14 TESTS 18 249 8192000 1600
170398308 -zse- E Aug. 31, 2022, 2:38 p.m. OK GNU C++14 TESTS 18 483 40243200 1600
170350646 hacker.NO.1 E Aug. 31, 2022, 6:08 a.m. OK GNU C++14 TESTS 18 514 8192000 1600
170402852 huangxinting666 E Aug. 31, 2022, 3:27 p.m. OK GNU C++14 TESTS 18 514 16384000 1600
170436054 DM11 E Sept. 1, 2022, 1:32 a.m. OK GNU C++14 TESTS 18 529 16179200 1600
170356383 Bhavyashah12050 E Aug. 31, 2022, 7:22 a.m. OK GNU C++14 TESTS 18 530 9113600 1600
170436922 DM11 E Sept. 1, 2022, 1:58 a.m. OK GNU C++14 TESTS 18 545 16179200 1600
170376086 LegendaryGrandsleeper E Aug. 31, 2022, 11:11 a.m. OK GNU C++14 TESTS 18 576 8192000 1600
170385527 Hackapie E Aug. 31, 2022, 12:38 p.m. OK GNU C++17 TESTS 18 233 8089600 1600
170375039 Narendramaddigunta E Aug. 31, 2022, 11 a.m. OK GNU C++17 TESTS 18 233 9728000 1600
170360360 SamuNatsu E Aug. 31, 2022, 8:10 a.m. OK GNU C++17 TESTS 18 234 8089600 1600
170353586 CurryWOE E Aug. 31, 2022, 6:46 a.m. OK GNU C++17 TESTS 18 264 8089600 1600
170367827 Altopc E Aug. 31, 2022, 9:40 a.m. OK GNU C++17 TESTS 18 295 8192000 1600
170357602 Huagass E Aug. 31, 2022, 7:37 a.m. OK GNU C++17 TESTS 18 342 8192000 1600
170408252 Red_rainOwO E Aug. 31, 2022, 4:31 p.m. OK GNU C++17 TESTS 18 483 8089600 1600
170416218 elliot101 E Aug. 31, 2022, 6:03 p.m. OK GNU C++17 TESTS 18 483 9625600 1600
170396589 DarkTigerFAF E Aug. 31, 2022, 2:21 p.m. OK GNU C++17 TESTS 18 498 8089600 1600
170446450 iwew E Sept. 1, 2022, 5:39 a.m. OK GNU C++17 TESTS 18 499 8192000 1600
170432275 ebarbs E Aug. 31, 2022, 11:35 p.m. OK GNU C++17 (64) TESTS 18 109 29491200 1600
170358108 propane E Aug. 31, 2022, 7:43 a.m. OK GNU C++17 (64) TESTS 18 124 8908800 1600
170392162 propane E Aug. 31, 2022, 1:37 p.m. OK GNU C++17 (64) TESTS 18 139 9420800 1600
170392099 propane E Aug. 31, 2022, 1:37 p.m. OK GNU C++17 (64) TESTS 18 140 9420800 1600
170350494 OTTFF E Aug. 31, 2022, 6:06 a.m. OK GNU C++17 (64) TESTS 18 140 10752000 1600
170382780 xiaoyiru7 E Aug. 31, 2022, 12:13 p.m. OK GNU C++17 (64) TESTS 18 140 11366400 1600
170391895 propane E Aug. 31, 2022, 1:35 p.m. OK GNU C++17 (64) TESTS 18 170 9420800 1600
170390541 TAoz1 E Aug. 31, 2022, 1:23 p.m. OK GNU C++17 (64) TESTS 18 187 52326400 1600
170389511 TAoz1 E Aug. 31, 2022, 1:15 p.m. OK GNU C++17 (64) TESTS 18 202 52326400 1600
170392369 TAoz1 E Aug. 31, 2022, 1:39 p.m. OK GNU C++17 (64) TESTS 18 202 52326400 1600
170436741 electronaota E Sept. 1, 2022, 1:53 a.m. OK GNU C++20 (64) TESTS 18 124 8908800 1600
170407935 tuanpham1032003 E Aug. 31, 2022, 4:27 p.m. OK GNU C++20 (64) TESTS 18 171 8089600 1600
170402553 menborong E Aug. 31, 2022, 3:24 p.m. OK GNU C++20 (64) TESTS 18 171 16896000 1600
170433929 Time_is_mana E Sept. 1, 2022, 12:28 a.m. OK GNU C++20 (64) TESTS 18 233 99328000 1600
170424321 doraty228 E Aug. 31, 2022, 8:06 p.m. OK GNU C++20 (64) TESTS 18 280 32051200 1600
170441787 Sabbir1807070 E Sept. 1, 2022, 4:01 a.m. OK GNU C++20 (64) TESTS 18 342 16179200 1600
170363066 ImperialALEN E Aug. 31, 2022, 8:40 a.m. OK GNU C++20 (64) TESTS 18 374 8089600 1600
170376023 temmieowo E Aug. 31, 2022, 11:10 a.m. OK GNU C++20 (64) TESTS 18 374 8089600 1600
170380624 LuluOwO E Aug. 31, 2022, 11:54 a.m. OK GNU C++20 (64) TESTS 18 374 8192000 1600
170375772 mdolchik E Aug. 31, 2022, 11:08 a.m. OK GNU C++20 (64) TESTS 18 389 16486400 1600
170395500 nguyenkimphuongtrang E Aug. 31, 2022, 2:10 p.m. OK Go TESTS 18 701 18534400 1600
170352396 singhshivsm20001 E Aug. 31, 2022, 6:31 a.m. OK Java 11 TESTS 18 966 8089600 1600
170355666 Hsharma E Aug. 31, 2022, 7:13 a.m. OK Java 11 TESTS 18 1418 8294400 1600
170379760 dyxdxy E Aug. 31, 2022, 11:46 a.m. OK Java 11 TESTS 18 1450 6144000 1600
170370359 amanpatel23 E Aug. 31, 2022, 10:12 a.m. OK Java 11 TESTS 18 1840 27648000 1600
170409470 amanraj01 E Aug. 31, 2022, 4:45 p.m. OK Java 11 TESTS 18 1840 55398400 1600
170355244 Prakrit18 E Aug. 31, 2022, 7:08 a.m. OK Java 11 TESTS 18 1949 22220800 1600
170443530 LoudSilence E Sept. 1, 2022, 4:42 a.m. OK Java 11 TESTS 18 2090 22220800 1600
170378607 LoudSilence E Aug. 31, 2022, 11:35 a.m. OK Java 11 TESTS 18 2184 22220800 1600
170362720 tanish_1131 E Aug. 31, 2022, 8:36 a.m. OK Java 11 TESTS 18 2198 8192000 1600
170365281 Jay_Bisht E Aug. 31, 2022, 9:04 a.m. OK Java 11 TESTS 18 2245 8192000 1600
170353369 vaibhav_1710 E Aug. 31, 2022, 6:43 a.m. OK Java 17 TESTS 18 1809 23552000 1600
170363902 brstplayer E Aug. 31, 2022, 8:49 a.m. OK Java 17 TESTS 18 2402 9420800 1600
170407336 chaosdevil E Aug. 31, 2022, 4:20 p.m. OK Java 17 TESTS 18 2854 47923200 1600
170350312 Xu_127 E Aug. 31, 2022, 6:04 a.m. OK Java 8 TESTS 18 1045 6656000 1600
170422162 ND_ E Aug. 31, 2022, 7:27 p.m. OK Java 8 TESTS 18 1045 6860800 1600
170404503 poopoop E Aug. 31, 2022, 3:46 p.m. OK Java 8 TESTS 18 1216 6758400 1600
170349650 sachinjaiswal E Aug. 31, 2022, 5:55 a.m. OK Java 8 TESTS 18 1403 18739200 1600
170392611 leoncn E Aug. 31, 2022, 1:41 p.m. OK Java 8 TESTS 18 1606 22016000 1600
170355701 yashpandey73 E Aug. 31, 2022, 7:14 a.m. OK Java 8 TESTS 18 1622 6860800 1600
170392250 leoncn E Aug. 31, 2022, 1:38 p.m. OK Java 8 TESTS 18 1637 14540800 1600
170370749 arutsudar E Aug. 31, 2022, 10:16 a.m. OK Java 8 TESTS 18 1731 20377600 1600
170353412 vaibhav_1710 E Aug. 31, 2022, 6:44 a.m. OK Java 8 TESTS 18 1747 20377600 1600
170359454 anshulchou_123 E Aug. 31, 2022, 7:59 a.m. OK Java 8 TESTS 18 1762 6656000 1600
170363636 Danbbler E Aug. 31, 2022, 8:47 a.m. OK MS C++ 2017 TESTS 18 467 16896000 1600
170364461 Killer_No.47 E Aug. 31, 2022, 8:56 a.m. OK MS C++ 2017 TESTS 18 889 8089600 1600
170363137 Danbbler E Aug. 31, 2022, 8:41 a.m. OK MS C++ 2017 TESTS 18 1044 16896000 1600
170398667 quickbreak E Aug. 31, 2022, 2:42 p.m. OK MS C++ 2017 TESTS 18 1107 9113600 1600
170387562 Fish_L E Aug. 31, 2022, 12:57 p.m. OK MS C++ 2017 TESTS 18 1231 8089600 1600
170362733 Danbbler E Aug. 31, 2022, 8:36 a.m. OK MS C++ 2017 TESTS 18 1325 16896000 1600
170398184 quickbreak E Aug. 31, 2022, 2:37 p.m. OK MS C++ 2017 TESTS 18 1559 17408000 1600
170362346 Danbbler E Aug. 31, 2022, 8:32 a.m. OK MS C++ 2017 TESTS 18 1591 16076800 1600
170395293 glyce E Aug. 31, 2022, 2:08 p.m. OK MS C++ 2017 TESTS 18 1746 17510400 1600
170392362 MrB0NAN E Aug. 31, 2022, 1:39 p.m. OK MS C++ 2017 TESTS 18 2058 9113600 1600
170369549 wizardrabbit E Aug. 31, 2022, 10:04 a.m. OK PyPy 3 TESTS 18 1996 45260800 1600
170350475 Jvaeyhcd E Aug. 31, 2022, 6:06 a.m. OK PyPy 3 TESTS 18 2402 48640000 1600
170410221 kamilszymczak1 E Aug. 31, 2022, 4:53 p.m. OK PyPy 3 TESTS 18 2947 47923200 1600
170408050 bergus E Aug. 31, 2022, 4:29 p.m. OK PyPy 3 TESTS 18 3150 89497600 1600
170435529 MinhQNgo E Sept. 1, 2022, 1:19 a.m. OK PyPy 3 TESTS 18 3525 42598400 1600
170423549 jeeveat E Aug. 31, 2022, 7:51 p.m. OK PyPy 3 TESTS 18 3541 42188800 1600
170354612 sky_coder_ E Aug. 31, 2022, 6:59 a.m. OK PyPy 3 TESTS 18 3634 42496000 1600
170348145 Mrs.Zhao E Aug. 31, 2022, 5:34 a.m. OK PyPy 3 TESTS 18 4008 55193600 1600
170372482 IamArsh E Aug. 31, 2022, 10:34 a.m. OK PyPy 3 TESTS 18 4555 59494400 1600
170353319 wanglijie E Aug. 31, 2022, 6:43 a.m. OK PyPy 3-64 TESTS 18 451 28262400 1600
170353736 wanglijie E Aug. 31, 2022, 6:48 a.m. OK PyPy 3-64 TESTS 18 966 50483200 1600
170423768 beethoven97 E Aug. 31, 2022, 7:56 p.m. OK PyPy 3-64 TESTS 18 1169 21299200 1600
170424410 beethoven97 E Aug. 31, 2022, 8:07 p.m. OK PyPy 3-64 TESTS 18 1169 22016000 1600
170423862 beethoven97 E Aug. 31, 2022, 7:58 p.m. OK PyPy 3-64 TESTS 18 1466 56320000 1600
170370186 batnik E Aug. 31, 2022, 10:10 a.m. OK PyPy 3-64 TESTS 18 1669 40550400 1600
170423677 beethoven97 E Aug. 31, 2022, 7:54 p.m. OK PyPy 3-64 TESTS 18 1700 23040000 1600
170372208 biglunchdude E Aug. 31, 2022, 10:31 a.m. OK PyPy 3-64 TESTS 18 1700 64000000 1600
170423371 beethoven97 E Aug. 31, 2022, 7:48 p.m. OK PyPy 3-64 TESTS 18 1715 22220800 1600
170377604 aman_m42 E Aug. 31, 2022, 11:25 a.m. OK PyPy 3-64 TESTS 18 1715 53452800 1600
170370786 kena0ki E Aug. 31, 2022, 10:16 a.m. OK Rust 2021 TESTS 18 389 8089600 1600
170370637 kena0ki E Aug. 31, 2022, 10:15 a.m. OK Rust 2021 TESTS 18 966 9113600 1600
170358062 Hyrulia E Aug. 31, 2022, 7:43 a.m. OK Rust 2021 TESTS 18 1200 22425600 1600
170358459 Hyrulia E Aug. 31, 2022, 7:47 a.m. OK Rust 2021 TESTS 18 1372 22425600 1600
170402402 ikoma E Aug. 31, 2022, 3:22 p.m. OK Rust 2021 TESTS 18 1809 16076800 1600
170383929 lightsnowball04 E Aug. 31, 2022, 12:24 p.m. OK Rust 2021 TESTS 18 1980 23449600 1600

remove filters

Back to search problems