14924 - EIAD Control System
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
| Case 7 |
1 sec |
32 MB |
| Case 8 |
1 sec |
32 MB |
Description

Source: Google
EIAD
You are tasked to design the control unit of the cutting-edge, ground-based air defense system EIAD (Extended-range Intercept Air Defense). The system manages a very long target sequence (implemented using linked list) to store the information of incoming bogeys. A bogey, by one of its definitions, is a human aircraft that hasn't been identified as a friendly or enemy yet.
IFF
Identification Friendly or Foe (IFF) is a real-world system for distinguishing friendlies from enemies, and vice versa. You are asked to implement a rudimentary (basic) IFF functionality for EIAD.
- A friendly bogey should be removed from the linked list without being intercepted.
- This is done by calling find_friendly().
Implementation & Template
To make EIAD into realization, you must implement the following core features in this air defense system:
- acquire()
- Insert bogey into the target linked list and update the length of the list.
- find_friendly()
- Given a friendly bogey ID, find whether the bogey is inside the target linked list. (see Input section)
- intercept()
- At each iteration, traverse the target linked list.
- Update the distance and update_time of each bogey.
- If a bogey's distance <= identification_distance, do something. (see Output section)
- Intercept any bogey that is <= engage_distance. (see Output section)
- If a bogey is <= danger_distance, simply remove it from the list and do nothing.
- reload()
- When EIAD runs out of missiles, it calls reload() and enters cooldown (duration: RT). (see Input section)
- When reloaded, the number of missiles goes back to M. (see Input section)
- You can build your own reloading mechanism as long as it works correctly.
- clear_sky()
- Check whether the linked list is empty. If true, output the final message and terminate the program. (see Output section)
- Data Flow (Read with Caution)
- Every bogey must go thorugh the process in the following order: (at each iteration)
- -> Acquire
- -> Presumed Hostile (<=1500)
- -> Intercept (if Presumed Hostile and <=1000)
- -> Remove the bogey from the linked list
- A bogey cannot and will not be identified and intercepted more than once.
- In each iteration, only intercept() or find_friendly() will be called once based on the input. They will not be called within the same iteration.

References
- Template BogeyNode:
- ID
- Distance
- Last_update_time
- Is_identified
- BogeyNode *next
- Distance parameters: (unit in meter)
- identification_distance = 1500
- engage_distance = 1000
- danger_distance = 250
Rules & Notes
- You can only use <iostream> and <string>. Other libraries are not allowed.
- Timestamp is a counter (variable) you need to maintain throughout the entire process.
- It begins at 0 and starts counting from the first "Bogey" input.
- Timestamp increments by 1 after each iteration.
- Every bogey travel at the speed of 50 meters per timestamp.
- If EIAD calls reload() at timestamp t, it will go back to intercept hostile bogeys at t + RT.
Input
The first line consists of:
M RT
From the 2nd line and onward: (with an EOF at the end)
Bogey ID Dist
Constraints
- M: the number of missiles that EIAD have before reloading, where 4 <= M <= 16.
- RT: the time for EIAD to reload its missiles, where 3 <= RT <= 6.
- ID: the id of a bogey. Each ID is guaranteed to be unique.
- Dist: the initial distance of a bogey, where 500 <= Dist <= 4000
- If Dist = -1, it means that the bogey is friendly. You should look for it in the linked list and generate outputs accordingly.
- N: the total number of incoming bogeys, where 1 <= N <= 7500.
- The first 4 testcases are guaranteed to not have input distance > 1500.
Output
- {} means the item inside is a variable.
- If a bogey ID is friendly and can be found in the linked list: (input Dist = -1)
- Tracking {ID}: Bogey Identified As Blue At Zulu Time {timestamp}
- If a bogey ID is friendly but is not found in the linked list: (input Dist = -1)
- Tracking {ID}: Blue On Blue Incident! Feel Sad :( At Zulu Time {timestamp}
- If a bogey's distance <= identification_distance:
- Tracking {ID}: Bogey Presumed To Be Hostile At Zulu Time {timestamp}
- When a bogey is intercepted:
- {ID} Intercepted At Zulu Time {timestamp}
Print out a newline character at the end of each output. When there clear_sky() returns true, print out "The Sky is Clear!" with a newline and terminate the program.
Tags