Codeforces Round 315 (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
568 Codeforces Round 315 (Div. 1) FINISHED False 7200 337181423 Aug. 10, 2015, 4:30 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 319 ) D Sign Posts PROGRAMMING brute force geometry math 2800

One Khanate had a lot of roads and very little wood. Riding along the roads was inconvenient, because the roads did not have road signs indicating the direction to important cities. The Han decided that it's time to fix the issue, and ordered to put signs on every road. The Minister of Transport has to do that, but he has only k signs. Help the minister to solve his problem, otherwise the poor guy can lose not only his position, but also his head. More formally, every road in the Khanate is a line on the Oxy plane, given by an equation of the form Ax + By + C = 0 ( A and B are not equal to 0 at the same time). You are required to determine whether you can put signs in at most k points so that each road had at least one sign installed. The input starts with two positive integers n , k ( 1 ≤ n ≤ 10 5 , 1 ≤ k ≤ 5 ) Next n lines contain three integers each, A i , B i , C i , the coefficients of the equation that determines the road ( | A i |, | B i |, | C i | ≤ 10 5 , A i 2 + B i 2 ≠ 0 ). It is guaranteed that no two roads coincide. If there is no solution, print "NO" in the single line (without the quotes). Otherwise, print in the first line "YES" (without the quotes). In the second line print a single number m ( m ≤ k ) — the number of used signs. In the next m lines print the descriptions of their locations. Description of a location of one sign is two integers v , u . If u and v are two distinct integers between 1 and n , we assume that sign is at the point of intersection of roads number v and u . If u = - 1 , and v is an integer between 1 and n , then the sign is on the road number v in the point not lying on any other road. In any other case the description of a sign will be assumed invalid and your answer will be considered incorrect. In case if v = u , or if v and u are the numbers of two non-intersecting roads, your answer will also be considered incorrect. The roads are numbered starting from 1 in the order in which they follow in the input. Note th

Tutorials

Codeforces Round #315 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
15326907 dwjshift D Jan. 13, 2016, 6:04 a.m. OK GNU C++ TESTS 39 46 3379200 2800
15326899 dwjshift D Jan. 13, 2016, 6:04 a.m. OK GNU C++ TESTS 39 46 3379200 2800
17896267 Gintoki D May 14, 2016, 12:35 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896259 Gintoki D May 14, 2016, 12:33 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896258 vjtest D May 14, 2016, 12:32 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896255 Gintoki D May 14, 2016, 12:31 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896229 Gintoki D May 14, 2016, 12:22 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896227 vjudge4 D May 14, 2016, 12:21 a.m. OK GNU C++ TESTS 39 46 3686400 2800
17896218 vjudge2 D May 14, 2016, 12:18 a.m. OK GNU C++ TESTS 39 46 3686400 2800
31100163 vjudge4 D Oct. 7, 2017, 5:18 a.m. OK GNU C++ TESTS 39 62 2048000 2800
18728705 065583 D June 26, 2016, 3:01 a.m. OK GNU C++11 TESTS 39 46 3584000 2800
12455909 MinakoKojima D Aug. 10, 2015, 7:01 p.m. OK GNU C++11 TESTS 39 46 28876800 2800
12457214 MinakoKojima D Aug. 10, 2015, 7:36 p.m. OK GNU C++11 TESTS 39 46 30412800 2800
12480570 Nero D Aug. 12, 2015, 1:55 p.m. OK GNU C++11 TESTS 39 62 3686400 2800
12480255 Sankarea D Aug. 12, 2015, 1:35 p.m. OK GNU C++11 TESTS 39 62 3686400 2800
15448725 suchir D Jan. 20, 2016, 6:24 a.m. OK GNU C++11 TESTS 39 62 6451200 2800
12549249 krijgertje D Aug. 15, 2015, 2:56 p.m. OK GNU C++11 TESTS 39 62 13926400 2800
12793952 geniucos D Aug. 31, 2015, 7:43 p.m. OK GNU C++11 TESTS 39 62 15155200 2800
12457932 Kaban-5 D Aug. 10, 2015, 8:25 p.m. OK GNU C++11 TESTS 39 62 17920000 2800
14037482 pegasas D Nov. 3, 2015, 6:01 a.m. OK GNU C++11 TESTS 39 62 18432000 2800
34544239 spfa D Jan. 25, 2018, 11:33 a.m. OK GNU C++14 TESTS 39 93 3584000 2800
25439565 Hujiwara D March 12, 2017, 4:54 p.m. OK GNU C++14 TESTS 39 93 6758400 2800
37749303 des1997 D April 30, 2018, 1:36 p.m. OK GNU C++14 TESTS 39 93 8192000 2800
49084209 black_horse2014 D Jan. 28, 2019, 7 a.m. OK GNU C++14 TESTS 39 109 9318400 2800
32302031 FallDream D Nov. 14, 2017, 2:26 a.m. OK GNU C++14 TESTS 39 124 1740800 2800
31098568 vjudge2 D Oct. 7, 2017, 4 a.m. OK GNU C++14 TESTS 39 187 9011200 2800
35376939 Dalgerok D Feb. 16, 2018, 9:11 p.m. OK GNU C++14 TESTS 39 187 16076800 2800
31107873 vjudge5 D Oct. 7, 2017, 9:16 a.m. OK GNU C++14 TESTS 39 202 5734400 2800
31107724 timber_wanglu D Oct. 7, 2017, 9:12 a.m. OK GNU C++14 TESTS 39 202 5734400 2800
21226754 sqc1999 D Oct. 6, 2016, 5:47 a.m. OK GNU C++14 TESTS 39 217 5734400 2800
52790575 alex_Harry D April 15, 2019, 5:07 p.m. OK GNU C++17 TESTS 39 78 4505600 2800
67788283 hjk1030 D Dec. 28, 2019, 1:39 p.m. OK GNU C++17 TESTS 39 109 1638400 2800
39987975 Roms D July 5, 2018, 2:58 p.m. OK GNU C++17 TESTS 39 139 5222400 2800
65740337 ruo D Nov. 26, 2019, 9:53 a.m. OK GNU C++17 TESTS 39 155 2048000 2800
61675736 tfg D Oct. 1, 2019, 8:29 p.m. OK GNU C++17 TESTS 39 311 10547200 2800
38680466 majk D May 27, 2018, 9:38 p.m. OK GNU C++17 TESTS 39 733 27340800 2800
12527760 kost D Aug. 14, 2015, 9:53 a.m. OK Haskell TESTS 39 1388 4198400 2800
12908756 ACLhj D Sept. 9, 2015, 11:42 a.m. OK Java 7 TESTS 39 171 0 2800
14198433 grothendieck D Nov. 11, 2015, 3:43 p.m. OK Java 8 TESTS 39 234 0 2800
12455773 Petr D Aug. 10, 2015, 6:59 p.m. OK Java 8 TESTS 39 296 0 2800
12457178 uwi D Aug. 10, 2015, 7:35 p.m. OK Java 8 TESTS 39 467 0 2800
12462607 og.kostya D Aug. 11, 2015, 7:10 a.m. OK MS C# TESTS 39 93 5120000 2800
12462404 og.kostya D Aug. 11, 2015, 6:50 a.m. OK MS C# TESTS 39 124 6451200 2800
12515350 Milanin D Aug. 13, 2015, 6:32 p.m. OK MS C++ TESTS 39 374 7680000 2800
23383345 sdya D Dec. 28, 2016, 5:37 p.m. OK MS C++ TESTS 39 842 7475200 2800
12456826 goodhope D Aug. 10, 2015, 7:20 p.m. OK MS C++ TESTS 39 1170 12288000 2800
12457060 ItsLastDay D Aug. 10, 2015, 7:29 p.m. OK PyPy 2 TESTS 39 1949 15360000 2800

remove filters

Back to search problems