Dota 322 for Droids

시간 제한1초메모리 제한2048 MB

요약
여섯 영웅 중 다섯을 순서대로 출력해, 그 순서만 보고 나머지 한 영웅을 복원할 수 있는 두 번 실행 프로토콜을 설계한다.
난이도

보통10점 중 4점

유형
조합론, 수학, 구현, 비트 연산
정답자
아직 제출이 없습니다

문제

DotA is a sick mental game. It brings out the best and worst in you. It comes down to half a second. You can't just predict what's going to happen. You try to look at everything as pieces and pawns. You try to look at it as simply "The Game". Who ended up winning the mental warfare always win the series. That's how you're going to win tournaments. If you break the other mind it gets really easy... Some minds are really hard to beat though.

Droid N4-2A was lost for days because he started playing DotA professionally. But it's not the game you might recognize: droids play a different version of it.

In DotA for droids, there are 245245 heroes divided into 55 attributes: strength, agility, intellect, universal, and stamina. But what's more interesting is the mode they are playing in: sixdraft. In this mode, as the name suggests, you are given 66 random heroes to pick among the 245245. Then, you ban (exclude) 55 of the given heroes in a particular order. The remaining 66-th hero is the hero you will play with.

Droid N4-2A is participating in the tournament. Of course, other droids will be following and even placing bets. During the sixdraft, the audience will see what 55 heroes Droid N4-2A has banned and in what order. Based on that, they can guess which hero was picked (the 66-th hero) and bet some money on that.

Droid N4-2A wants to earn some money from it as well. He wants to collaborate with his friend Droid C-228PO, who will be betting. For 66 random heroes he gets, he wants to find a way to choose particular 55 heroes and ban them in such an order that his friend will be able to guess the 66-th remaining hero.

They want to think of a universal protocol that will allow them to earn money in every game. Help them!

This problem is in run-twice format. This means your program will be executed twice for the same test with different inputs.

During the first run, nn is 66. It means your program must act as Droid N4-2A. You will be given 66 heroes, and you need to print 55 of them in some order.

During the second run, nn is 55. It means your program must act as Droid C-228PO. You will be provided with 55 heroes: your output from the previous run. Note that the order of heroes will be preserved. You need to print the 66-th hero.

입력

The first line contains nn, the number of heroes. The value of nn is either 55 or 66.

The second line contains nn distinct integers a_ia\_i (1≤a_i≤2451 \le a\_i \le 245).

If nn is 55, it is guaranteed that a_ia\_i are the heroes you printed during the previous run, and their order is preserved.

출력

When nn is 66, print 55 integers: the heroes you want to ban.

When nn is 55, print a single integer: the remaining 66-th hero.

힌트

The provided examples are the two invocations on the first test.

예제3

  1. 예제 1

    입력
    6
    1 2 3 4 5 6
    
    예상 출력
    1 3 5 6 2
    
  2. 예제 2

    입력
    5
    1 3 5 6 2
    
    예상 출력
    4
    
  3. 예제 3

    입력
    6
    6 4
    1 3
    4 5
    2 3
    4 3
    
    예상 출력
    8