5/10/25, 11:43 AM Problem - B - Codeforces
|
I_Love_HoangTrang | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS STANDINGS CUSTOM INVOCATION
Central-European Olympiad in
B. Roads Informatics, CEOI 2020, Day 1
(IOI, Unofficial Mirror Contest,
time limit per test: 1.5 seconds Unrated)
memory limit per test: 256 megabytes
Finished
The government of Treeland wants to build a new road network. There are 2N cities in Treeland. Practice
The unfinished plan of the road network already contains N road segments, each of which
connects two cities with a straight line. No two road segments have a common point (including
their endpoints). Your task is to determine N − 1 additional road segments satisfying the
following conditions:
→ Virtual participation
1. Every new road segment must connect two cities with a straight line. Virtual contest is a way to take part in past
2. If two segments (new or old) have a common point, then this point must be an endpoint of contest, as close as possible to participation
on time. It is supported only ICPC mode for
both segments. virtual contests. If you've seen these
3. The road network connects all cities: for each pair of cities there is a path consisting of problems, a virtual contest is not for you -
solve these problems in the archive. If you
segments that connects the two cities. just want to solve some problem from a
contest, a virtual contest is not for you -
solve this problem in the archive. Never use
Input someone else's code, read the tutorials or
5
The first line of the standard input contains N (2 ≤ N ≤ 10 ) – the number of existing road communicate with other person during a
virtual contest.
segments. Each of the following N lines contains four integers: x 1 , y1 , x 2 , y2 , where (x 1 , y1 )
and (x 2 , y2 ) are the coordinates of the endpoints of the segment (−107 ≤ x i , yi ≤ 107 ). Start virtual contest
Output
The standard output must contain N − 1 lines, each of them containing four integers, → Clone Contest to Mashup
x 1 , y1 , x 2 , y2 , where (x 1 , y1 ) and (x 2 , y2 ) are the coordinates of the cities that are the
endpoints of a new road segment. If there are multiple solutions, your program may output any of You can clone this contest to a mashup.
them. Clone Contest
Scoring
Subtask Points Constraints
→ Submit?
1 0 samples
2 15 all input segments are vertical.
Language: GNU G++17 7.3.0
3 15 each pair of input segments are parallel.
Choose
Choose File No file chosen
4 15 each input segment is either horizontal or vertical. file:
5 15 N ≤ 10 000
Submit
6 40 no additional constraints
Example
input Copy → Problem tags
5
*special problem geometry sortings
1 3 3 6
5 1 5 3 *2900
3 3 6 5 No tag edit access
2 1 4 1
2 3 4 2
output Copy → Contest materials
2 1 1 3
CEOI 2020 Online Mirror (en)
2 3 2 1
3 3 2 3 Editorial (en)
5 1 4 2
Note
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: May/10/2025 11:43:53UTC+7 (n2).
https://codeforces.com/contest/1402/problem/B 1/2
5/10/25, 11:43 AM Problem - B - Codeforces
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by
https://codeforces.com/contest/1402/problem/B 2/2