Logo
(追記) (追記ここまで)

19454번 - Almost Longest Increasing Subsequence 다국어인터랙티브

시간 제한메모리 제한제출정답맞힌 사람정답 비율
13 초 256 MB228736.842%

문제

Suppose you are given a permutation $a$ of $n$ numbers from 1ドル$ to $n$. In a usual task you would have to find its {\it longest increasing subsequence}: indices $i_1,ドル $\ldots,ドル $i_k$ such that $i_1 < \ldots < i_k$ and $a_{i_1} < \ldots < a_{i_k},ドル where $k$ is maximum possible.

However, this time the task is different: the numbers are given online, so you must decide whether you take the number or not before you receive the next number. You also know that the input permutation is random, that is, selected uniformly at random from the set of all $n!$ possible permutations. Under these requirements it is impossible to surely find the longest increasing subsequence, but you have to just do good enough. Formally, let $k$ be the length of the longest increasing subsequence of the given permutation. Then, finding any increasing subsequence of length at least 0ドル.65k$ will suffice.

입력

출력

제한

프로토콜

First, interactor sends a single number $n$ ($n = 10^5$) which is the length of the permutation. Next, interactor sends $n$ numbers one by one, each on a separate line. After receiving each number you should print one integer to the standard output, which is 1ドル$ if you take the given number and 0ドル$ otherwise.

The sequence given is a permutation of 1ドル,ドル $\ldots,ドル $n$: all elements are distinct and each of then is from 1ドル$ to $n$.

Every number selected by participant (except for the first one) should be greater than the previous one.

In the sample case $n = 5$. Any solution which follows the output format passes this testcase.

예제 입력 1

5
2
1
5
4
3

예제 출력 1

1
0
1
0
0

힌트

The sample test is used only to illustrate the interaction format and is not included in the testset. Each test from the testset has $n = 10^5$.

In this problem, technically, a random permutation is an array of 1ドル,ドル $\ldots,ドル $n$ shuffled with some pseudo-random number generator.

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 3: Moscow IPT Contest A번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /