Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 833961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:36:08+00:00 2026-05-15T04:36:08+00:00

I’m training code problems, and on this one I am having problems to solve

  • 0

I’m training code problems, and on this one I am having problems to solve it, can you give me some tips how to solve it please.

The problem is taken from here:

https://www.ieee.org/documents/IEEEXtreme2008_Competitition_book_2.pdf

Problem 12: Cynical Times.

The problem is something like this (but do refer to above link of the source problem, it has a diagram!):

Your task is to find the sequence of points on the map that the bomber is expected to travel such that it hits all vital links. A link from A to B is vital when its absence isolates completely A from B. In other words, the only way to go from A to B (or vice versa) is via that link.

Due to enemy counter-attack, the plane may have to retreat at any moment, so the plane should follow, at each moment, to the closest vital link possible, even if in the end the total distance grows larger.

Given all coordinates (the initial position of the plane and the nodes in the map) and the range R, you have to determine the sequence of positions in which the plane has to drop bombs.

This sequence should start (takeoff) and finish (landing) at the initial position. Except for the start and finish, all the other positions have to fall exactly in a segment of the map (i.e. it should correspond to a point in a non-hit vital link segment).

The coordinate system used will be UTM (Universal Transverse Mercator) northing and easting, which basically corresponds to a Euclidian perspective of the world (X=Easting; Y=Northing).

Input
Each input file will start with three floating point numbers indicating the X0 and Y0 coordinates of the airport and the range R. The second line contains an integer, N, indicating the number of nodes in the road network graph. Then, the next N (<10000) lines will each contain a pair of floating point numbers indicating the Xi and Yi coordinates (1 < i<=N). Notice that the index i becomes the identifier of each node. Finally, the last block starts with an integer M, indicating the number of links. Then the next M (<10000) lines will each have two integers, Ak and Bk (1 < Ak,Bk <=N; 0 < k < M) that correspond to the identifiers of the points that are linked together.

No two links will ever cross with each other.

Output
The program will print the sequence of coordinates (pairs of floating point numbers with exactly one decimal place), each one at a line, in the order that the plane should visit (starting and ending in the airport).

Sample input 1

102.3 553.9 0.2 
14 
342.2 832.5 
596.2 638.5 
479.7 991.3 
720.4 874.8 
744.3 1284.1 
1294.6 924.2 
1467.5 659.6 
1802.6 659.6 
1686.2 860.7 
1548.6 1111.2 
1834.4 1054.8 
564.4 1442.8 
850.1 1460.5 
1294.6 1485.1 
17 
1 2 
1 3 
2 4 
3 4 
4 5 
4 6 
6 7 
7 8 
8 9 
8 10 
9 10 
10 11 
6 11 
5 12 
5 13 
12 13 
13 14 

Sample output 1
102.3 553.9 
720.4 874.8 
850.1 1460.5 
102.3 553.9 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T04:36:09+00:00Added an answer on May 15, 2026 at 4:36 am

    I think Moron‘ is right about the first part, but on the second part…
    The problem description does not tell anything about “smallest number of points”. It tells that the plane flies to the closest vital link.
    So, I think the part 2 will be much simpler:

    • Find the closest non-hit segment to the current location.
    • Travel to the closest point on the closest segment.
    • Bomb the current location (remove all segments intersecting a circle)
    • Repeat until there are no non-hit vital links left.

    This straight-forward algorithm has a complexity of O(N*N), but this should be sufficient considering input constraints.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 441k
  • Answers 441k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Pretty late but since there is no answer as of… May 15, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer Here is example of TabItem ControlTemplate Copy it to your… May 15, 2026 at 5:41 pm
  • Editorial Team
    Editorial Team added an answer You can mark data members with the keyword mutable to… May 15, 2026 at 5:41 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.