Codeforces Round 666 (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
1396 Codeforces Round 666 (Div. 1) FINISHED False 7200 133025099 Aug. 30, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 310 ) D Rainbow Rectangles PROGRAMMING data structures

B"Shrimpy Duc is a fat and greedy boy who is always hungry. After a while of searching for food to satisfy his never-ending hunger, Shrimpy Duc finds M&M candies lying unguarded on a L x L grid. There are n M&M candies on the grid, the i -th M&M is currently located at (x_i + 0.5, y_i + 0.5), and has color c_i out of a total of k colors (the size of M&Ms are insignificant). Shrimpy Duc wants to steal a rectangle of M&Ms, specifically, he wants to select a rectangle with integer coordinates within the grid and steal all candies within the rectangle. Shrimpy Duc doesn't need to steal every single candy, however, he would like to steal at least one candy for each color. In other words, he wants to select a rectangle whose sides are parallel to the coordinate axes and whose left-bottom vertex (X_1, Y_1) and right-top vertex (X_2, Y_2) are points with integer coordinates satisfying 0 <= X_1 < X_2 <= L and 0 <= Y_1 < Y_2 <= L , so that for every color 1 <= c <= k there is at least one M&M with color c that lies within that rectangle. How many such rectangles are there? This number may be large, so you only need to find it modulo 10^9 + 7 . The first line contains three positive integers n, k, L (1 <= q k <= q n <= q 2 cdot 10^3, 1 <= q L <= q 10^9 ) -- the number of M&Ms, the number of colors and the length of the grid respectively. The following n points describe the M&Ms. Each line contains three integers x_i, y_i, c_i (0 <= q x_i, y_i < L, 1 <= c_i <= k) -- the coordinates and color of the i -th M&M respectively. Different M&Ms have different coordinates ( x_i ne x_j or y_i ne y_j for every i ne j ), and for every 1 <= c <= k there is at least one M&M with color c . Output a single integer -- the number of rectangles satisfying Shrimpy Duc's conditions, modulo 10^9 + 7 . Grid for the first sample: "...

Tutorials

Codeforces Round #666 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
91543350 2018LZY D Sept. 1, 2020, 7:08 a.m. OK GNU C++11 TESTS 75 358 204800
91544914 2018LZY D Sept. 1, 2020, 7:30 a.m. OK GNU C++11 TESTS 75 373 204800
91546194 2018LZY D Sept. 1, 2020, 7:49 a.m. OK GNU C++11 TESTS 75 374 204800
91541301 gongsuidashen D Sept. 1, 2020, 6:34 a.m. OK GNU C++11 TESTS 75 405 204800
91602452 Scarlet_Hypoc D Sept. 1, 2020, 11:12 p.m. OK GNU C++11 TESTS 77 436 307200
91533757 2018LZY D Sept. 1, 2020, 3:44 a.m. OK GNU C++11 TESTS 75 468 204800
91458698 Eric_hooo D Aug. 31, 2020, 5:25 a.m. OK GNU C++11 TESTS 75 858 4505600
91531019 charlieyan D Sept. 1, 2020, 2:11 a.m. OK GNU C++11 TESTS 75 873 716800
91436725 frodakcin D Aug. 30, 2020, 7:56 p.m. OK GNU C++11 TESTS 75 951 4300800
91648591 hongvip1638 D Sept. 2, 2020, 2:18 p.m. OK GNU C++11 TESTS 77 1123 512000
91491622 consecutivelimit D Aug. 31, 2020, 12:50 p.m. OK GNU C++14 TESTS 75 436 204800
91426065 ugly2333 D Aug. 30, 2020, 5:59 p.m. OK GNU C++14 TESTS 75 624 4505600
91433671 zeliboba D Aug. 30, 2020, 7:12 p.m. OK GNU C++14 TESTS 75 717 4403200
91603245 ZZZZZZZZZZZZZZZZZZ D Sept. 1, 2020, 11:51 p.m. OK GNU C++14 TESTS 77 732 512000
91454740 A.K.E.E. D Aug. 31, 2020, 4:27 a.m. OK GNU C++14 TESTS 75 857 4403200
91420254 KMAASZRAA D Aug. 30, 2020, 4:34 p.m. OK GNU C++14 TESTS 75 920 20889600
91568026 beginend D Sept. 1, 2020, 1:12 p.m. OK GNU C++14 TESTS 76 951 614400
91626940 oipotato D Sept. 2, 2020, 9:12 a.m. OK GNU C++14 TESTS 77 1216 16691200
91543446 danya090699 D Sept. 1, 2020, 7:10 a.m. OK GNU C++14 TESTS 75 1278 1228800
91683197 BTSprathampatel D Sept. 3, 2020, 2:58 a.m. OK GNU C++14 TESTS 77 1309 409600
91485728 BThero D Aug. 31, 2020, 11:27 a.m. OK GNU C++17 TESTS 75 436 68710400
91532038 tlnllkbp D Sept. 1, 2020, 2:47 a.m. OK GNU C++17 TESTS 75 670 512000
91494681 kczno1 D Aug. 31, 2020, 1:27 p.m. OK GNU C++17 TESTS 75 1013 409600
91629560 alexander86 D Sept. 2, 2020, 9:54 a.m. OK GNU C++17 TESTS 77 1075 512000
91663384 penguin1017 D Sept. 2, 2020, 5:27 p.m. OK GNU C++17 TESTS 77 1107 512000
91627200 He_Ren D Sept. 2, 2020, 9:16 a.m. OK GNU C++17 TESTS 77 1107 819200
91453107 1111wer D Aug. 31, 2020, 3:58 a.m. OK GNU C++17 TESTS 75 1122 4403200
91431235 effort D Aug. 30, 2020, 6:42 p.m. OK GNU C++17 TESTS 75 1122 4403200
91426351 Shreyansh_J13 D Aug. 30, 2020, 6:01 p.m. OK GNU C++17 TESTS 75 1122 4403200
91529108 yash257 D Sept. 1, 2020, 12:46 a.m. OK GNU C++17 TESTS 75 1123 716800
91442503 skip2004 D Aug. 30, 2020, 10:26 p.m. OK GNU C++17 (64) TESTS 75 312 6451200
91407249 Benq D Aug. 30, 2020, 4:10 p.m. OK GNU C++17 (64) TESTS 75 514 9625600
91563928 AuqaKyz D Sept. 1, 2020, 12:17 p.m. OK GNU C++17 (64) TESTS 76 639 16793600
91410504 Egor D Aug. 30, 2020, 4:16 p.m. OK GNU C++17 (64) TESTS 75 920 5120000
91463046 jiangly D Aug. 31, 2020, 6:24 a.m. OK GNU C++17 (64) TESTS 75 935 4915200
91405665 Isonan D Aug. 30, 2020, 4:07 p.m. OK GNU C++17 (64) TESTS 75 936 6553600
91637714 ycx_girlfriend D Sept. 2, 2020, 11:55 a.m. OK GNU C++17 (64) TESTS 77 951 921600
91427255 gepardo D Aug. 30, 2020, 6:06 p.m. OK GNU C++17 (64) TESTS 75 967 5120000
91427085 gepardo D Aug. 30, 2020, 6:05 p.m. OK GNU C++17 (64) TESTS 75 997 5222400
91434541 amethyst0 D Aug. 30, 2020, 7:24 p.m. OK GNU C++17 (64) TESTS 75 1122 5222400
91654004 cwise D Sept. 2, 2020, 3:23 p.m. OK Java 8 TESTS 77 2651 26624000

remove filters

Back to search problems