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

21085번 - Output Limit Exceeded 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB45151231.579%

문제

We all know that $\binom{n}{k} = \frac{n \cdot (n-1) \cdot \ldots \cdot (n-k+2) \cdot (n-k+1)}{1 \cdot 2 \cdot \ldots \cdot (k-1) \cdot k}$ is an integer number for any 0ドル \le k \le n$. But it would be nice if we could prove it by providing a matching between factors in numerator and denominator, wouldn't it?

Let's build a bipartite graph with $k$ vertices in each part. The $i$-th vertex in the left part corresponds to factor $(n+1-i)$ from numerator and $j$-th vertex in the right part corresponds to factor $j$ from denominator. There is an edge $i$ --- $j$ if and only if $j$ divides $(n+1-i)$. The number $k$ is provable for $n$ if there is a perfect matching in this bipartite graph.

Given $n,ドル check if $k$ is provable for each $k$ satisfying 0ドル \le k \le n$.

입력

The only line contains one integer $n$ (0ドル \le n \le 10^{18}$).

출력

Print string of length $(n+1)$ consisting of '0' and '1', $(k+1)$-th character should be '1' if and only if $k$ is provable for $n$.

What, you think this will get Output Limit Exceeded? Hmmmm... Okay. Let's compress the string.

Let $s_0 = \text{“0”}$ and $s_1 = \text{“1”}$. You can define $s_{2}, s_{3}, \ldots, s_{t}$. String $s_{i}$ should be a concatenation of several earlier defined strings. Formally, $\forall \: i \: (2 \le i \le t): s_{i} = s_{j_{1}} + s_{j_{2}} + \ldots + s_{j_{k_{i}}},ドル here 1ドル \le k_{i},ドル $\forall \: r \: (1 \le r \le k_{i}): j_{r} < i$. String $s_{t}$ should be the answer to the problem.

In the first line print one integer $t$ (2ドル \le t \le 500$).

In the next $t-1$ lines print the descriptions of $s_{i}$. Each description should have a form $k_{i} \: j_{1} \: j_{2} \: \ldots \: j_{k_{i}},ドル with 1ドル \le k_{i}$ and 0ドル \le j_{r} < i$.

Total length of all descriptions should not exceed 10ドル,000円$: $\sum_{i=2}^{t} k_{i} \le 10,000円$.

We can show that for all valid tests there exists a way to construct the answer string abiding all the limitations. If there are several possible ways to do so, print any one of them. Note that you don't have to minimize $t$ or total length of all descriptions.

제한

예제 입력 1

1

예제 출력 1

2
2 1 1

예제 입력 2

0

예제 출력 2

2
1 1

예제 입력 3

7

예제 출력 3

4
2 1 1
4 1 2 0 0
3 3 1 2

힌트

In the third sample: $s_2 = s_1 + s_1 = \text{"1"}+\text{"1"} = \text{"11"},ドル $s_3 = s_1 + s_2 + s_0 + s_0 = \text{"1"}+\text{"11"}+\text{"0"}+\text{"0"} = \text{"11100"},ドル $s_4 = s_3 + s_1 + s_2 = \text{"11100"}+\text{"1"}+\text{"11"} = \text{"11100111"},ドル

출처

Camp > Petrozavodsk Programming Camp > Winter 2021 > Day 5: Almost Retired Dandelion Contest, ICPC Camp Contest 2 D번

Contest > Open Cup > 2020/2021 Season > Stage 11: Grand Prix of Nizhny Novgorod D번

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

출처

대학교 대회

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

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