Magic Trick
시간 제한2초메모리 제한2048 MB
한 사람이 순열에서 K장의 카드를 뒤집어 숨기면 다른 사람이 숨긴 값을 모두 알아내는 전략을 설계하고 K를 최대화한다.
문제
Alicia and Beatriz are preparing a magic trick for the IOI Talent Show. The trick works as follows:
- A volunteer selects a permutation of length and places cards on the table. The cards are numbered from to , with card displaying the value .
- Alicia enters the room, observes the cards, and selects of them to flip face down, hiding their values.
- Beatriz then enters the room, sees the current arrangement of the cards (including which ones are face down), and magically determines the values of all hidden cards!
Your task is to devise and implement a strategy for Alicia and Beatriz. The more impressive the trick, the better your score: the objective is to maximize , the number of hidden cards Beatriz can correctly reveal.
제한
- for each such that .
- All values in are distinct.
예제
이 문제는 공개된 예제가 없습니다.