Codeforces Round 1048 (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
2138 Codeforces Round 1048 (Div. 1) FINISHED False 10800 19063523 Sept. 8, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 80 ) F Ode to the Bridge Builder PROGRAMMING constructive algorithms

You are given a 2D plane. Initially, two points (P_1) and (P_2) are located at ((0,0)) and ((1,0)), respectively, with a line segment connecting them. You can draw triangles using the following operation: Choose two points (A) and (B) that are directly connected by a line segment (i.e., (A) and (B) must be the endpoints of an existing segment). Choose two real numbers (x) and (y) such that (-2\cdot 10^4\le x, y\le 2\cdot 10^4). Draw a new point (C) at coordinates ((x,y)). Then, draw line segments (AC) and (BC), forming triangle (\triangle ABC). The length (l) of every side of the new triangle (\triangle ABC) must satisfy (0.5\le l\le 1). Note that each operation draws one new point and two new line segments. Your task is to draw a point at coordinates ((p, q)) using at most (m = \left\lceil 2\sqrt{p^2 + q^2}\right\rceil) operations, where (\lceil x\rceil) is the smallest integer greater than or equal to (x). It is guaranteed that (p) and (q) are positive integers. Due to potential rounding errors: The constructed vertex only needs to be within (10^{-4}) of ((p,q)). For triangle side lengths, an absolute error of (10^{-8}) is allowed (i.e., (0.5 - 10^{-8} \le l \le 1 + 10^{-8})). Note that the target point may be created before the last operation (see the second test case). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains three integers (p), (q), and (m) ((1\le p, q\le 10^4), (m = \left\lceil 2\sqrt{p^2 + q^2}\right\rceil)) — the (x) and (y) coordinates of the target, and the maximum number of operations you are allowed to perform, respectively. It is guaranteed that the sum of (m) over all test cases does not exceed (10^5). For each test case, output

Tutorials

Codeforces Round 1048 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
337696576 Andrew_sun F Sept. 9, 2025, 3:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 45 311 1228800
337684973 h-Bar F Sept. 9, 2025, 12:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 45 311 4096000
337666355 Time_Out_Soul F Sept. 8, 2025, 7:01 p.m. OK C++23 (GCC 14-64, msys2) TESTS 45 327 102400
337643014 ecnerwala F Sept. 8, 2025, 4:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 45 328 0
337649984 ksun48 F Sept. 8, 2025, 5:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 45 406 1228800
337691280 Fakewave F Sept. 9, 2025, 2:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 45 421 102400
337653849 rainboy F Sept. 8, 2025, 5:13 p.m. OK GNU C11 TESTS 45 906 3379200
337668865 sunnydev F Sept. 8, 2025, 7:22 p.m. OK Java 8 TESTS 45 905 0
337689404 bronze_coder F Sept. 9, 2025, 2:11 a.m. OK PyPy 3-64 TESTS 45 437 11673600
337687617 smilences F Sept. 9, 2025, 1:38 a.m. OK Python 3 TESTS 45 405 6860800
337688977 smilences F Sept. 9, 2025, 2:03 a.m. OK Python 3 TESTS 45 437 6246400

remove filters

Back to search problems