아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Permutation

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

요약
각 k에 대해 증가 부분수열의 개수(빈 부분수열 포함)가 정확히 k가 되는 순열을 짧은 길이로 구성한다.
난이도

보통10점 중 7점

유형
조합론, 동적 계획법, 그리디
정답자
아직 제출이 없습니다

문제

The Pharaohs use the relative movement and gravity of planets to accelerate their spaceships. Suppose a spaceship will pass by nn planets with orbital speeds p\[0],p\[1],…,p\[n−1]p\[0], p\[1], \ldots, p\[n-1] in order. For each planet, the Pharaohs scientists can choose whether to accelerate the spaceship using this planet or not. To save energy, after accelerating by a planet with orbital speed p\[i]p\[i], the spaceship cannot be accelerated using any planet with orbital speed p\[j]<p\[i]p\[j] < p\[i]. In other words, the chosen planets form an increasing subsequence of p\[0],p\[1],…,p\[n−1]p\[0], p\[1], \ldots, p\[n-1]. A subsequence of p is a sequence that's derived from pp by deleting zero or more elements of pp. For example \[0]\[0], \[]\[], \[0,2]\[0,2] , and \[0,1,2]\[0,1,2] are subsequences of \[0,1,2]\[0,1,2], but \[2,1]\[2,1] is not.

The scientists have identified that there are a total of kk different ways a set of planets can be chosen to accelerate the spaceship, but they have lost their record of all the orbital speeds (even the value of nn). However, they remember that (p\[0],p\[1],…,p\[n−1])(p\[0],p\[1],\ldots, p\[n-1]) is a permutation of 0,1,…,n−1{0, 1, \ldots, n-1}. A permutation is a sequence containing each integer from 00 to n−1n-1 exactly once. Your task is to find one possible permutation p\[0],p\[1],…,p\[n−1]p\[0], p\[1], \ldots, p\[n-1] of sufficiently small length.

You need to solve the problem for qq different spaceships. For each spaceship ii, you get an integer k_ik\_i, representing the number of different ways a set of planets can be chosen to accelerate the spaceship. Your task is to find a sequence of orbital speeds with a small enough length n_in\_i such that there are exactly k_ik\_i ways a subsequence of planets with increasing orbital speeds can be chosen.

제한

  • 1≤q≤1001 \le q \le 100
  • 2≤k_i≤10182 \le k\_i \le 10^{18} (for all 0≤i≤q−10 \leq i \le q-1)

예제

이 문제는 공개된 예제가 없습니다.