#C6800. Remove Repeated Waypoints

    ID: 50601 Type: Default 1000ms 256MiB

Remove Repeated Waypoints

Remove Repeated Waypoints

Given a list of waypoints, your task is to remove all repeated waypoints while keeping only the first occurrence of each waypoint. In other words, if a waypoint appears multiple times in the list, only the first appearance should be kept and all subsequent duplicates removed.

Formally, given an integer NN and a sequence a1,a2,,aNa_1, a_2, \dots, a_N, produce a sequence b1,b2,,bkb_1, b_2, \dots, b_k such that each bib_i appears in the order of their first occurrence in the given sequence and no element appears more than once.

inputFormat

The input is given via standard input. The first line contains an integer NN, representing the number of waypoints. The second line contains NN space-separated integers, where each integer represents a waypoint.

outputFormat

Output the unique waypoints in the order they first appeared, separated by a single space. If there are no waypoints, output an empty line.## sample

5
1 2 3 2 1
1 2 3