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

31737번 - Table Tennis 서브태스크스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB23101055.556%

문제

A table tennis competition was held in JOI Kingdom. $N$ beavers numbered from 1ドル$ to $N$ participated in this competition, and a round-robin tournament was conducted.

You were told the following information about the result of this competition from Bitaro.

  • There were no draw match.
  • There are exactly $M$ ways to choose 3ドル$ beavers which are trilemma. Note that 3ドル$ beavers $i,ドル $j,ドル $k$ (1ドル ≤ i < j < k ≤ N$) are trilemma if and only if exactly one of the following 2ドル$ conditions is satisfied.
    • Beaver $i$ beat beaver $j,ドル beaver $j$ beat beaver $k,ドル and beaver $k$ beat beaver $i$.
    • Beaver $i$ beat beaver $k,ドル beaver $k$ beat beaver $j,ドル and beaver $j$ beat beaver $i$.

You don’t know whether the information from Bitaro is correct, so you decided to think whether there are any results of this competition which accord with the information from Bitaro.

Write a program which, given the information from Bitaro, judge whether there are any results of this competition which accord with the information, and if so, finds one such result of this competition.

입력

A test case consists of $Q$ scenarios, numbered from 1ドル$ to $Q$. The following values are specified for each scenario.

  • The number of beavers $N$ which participated in the competition.
  • The number of ways $M$ to choose 3ドル$ beavers which are trilemma.

The format of the input data is as follows.

$Q$

(Input for Scenario 1ドル$)

(Input for Scenario 2ドル$)

$\vdots$

(Input for Scenario $Q$)

The format of the input data for each scenario is as follows.

$N$ $M$

출력

Write to standard output the answer of Scenario 1,ドル 2, \dots , Q$ in order as follows.

In some scenario, if there are any results of this competition which accord with the information, output as follows.

Yes

$S_2$

$S_3$

$\vdots$

$S_N$

Here, $S_i$ (2ドル \le i \le N$) is a string of which characters are '0' or '1' and length is $i-1$. $j$-th character of $S_i$ is '0' means beaver $i$ was defeated beaver $j,ドル and $j$-th character of $S_i$ is '1' means beaver $i$ won beaver $j$. If multiple results exist, you can output any of them.

In some scenario, if there are not any results of this competition which accord with the information, output No.

제한

  • 1ドル ≤ Q$.
  • 3ドル ≤ N ≤ 5,円 000$.
  • 0ドル ≤ M ≤ \frac{1}{6}N(N - 1)(N - 2)$.
  • The sum of $N$ for the $Q$ scenarios is less than or equal to 5ドル,円 000$.
  • Given values are all integers.

서브태스크

번호배점제한
15

$M ≤ N - 2$.

24

The sum of $N$ for the $Q$ scenarios is less than or equal to 7ドル$.

323

The sum of $N$ for the $Q$ scenarios is less than or equal to 20ドル$.

430

The sum of $N$ for the $Q$ scenarios is less than or equal to 150ドル$.

515

The sum of $N$ for the $Q$ scenarios is less than or equal to 600ドル$.

623

No additional constraints.

예제 입력 1

2
3 1
4 4

예제 출력 1

Yes
0
10
No

There are $Q = 2$ scenarios.

In the results of scenario 1ドル$ in this sample output, beaver 1ドル$ won beaver 2ドル,ドル beaver 2ドル$ won beaver 3ドル,ドル and beaver 3ドル$ won beaver 1ドル$. Therefore, 3ドル$ beavers 1ドル,ドル 2ドル,ドル 3ドル$ are trilemma. There is no other ways to choose 3ドル$ beavers, so there are exactly 1ドル$ ways to choose 3ドル$ beavers which are trilemma.

There is another output corresponds to scenario 1ドル$ as follows.

Yes
1
01

In scenario 2ドル,ドル there are not any results of this competition which accord with the information. Therefore, output No.

This sample input satisfies the constraints of Subtasks 2, 3, 4, 5, 6.

예제 입력 2

1
5 3

예제 출력 2

Yes
0
11
001
0101

In the results of scenario 1ドル$ in this sample output, beaver 1ドル$ won beaver 4ドル,ドル beaver 4ドル$ won beaver 3ドル,ドル and beaver 3ドル$ won beaver 1ドル$. Therefore, 3ドル$ beavers 1ドル,ドル 3ドル,ドル 4ドル$ are trilemma. There are two other ways to choose 3ドル$ beavers which are trilemma: choose beavers 2ドル,ドル 3ドル,ドル 4ドル$ and choose beavers 3ドル,ドル 4ドル,ドル 5ドル$. Therefore, there are exactly 3ドル$ ways to choose 3ドル$ beavers which are trilemma.

This sample input satisfies the constraints of all the subtasks.

힌트

출처

Camp > JOI Spring Training Camp > JOI 2023/2024 Spring Training Camp 4-3번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 2이다.
(追記) (追記ここまで)

출처

대학교 대회

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

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