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

32486번 - Jigsaw Present 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 (추가 시간 없음) 2048 MB30101058.824%

문제

Julia is preparing a present for James. She will give him some of her $n$ jigsaw puzzles, where puzzle $i$ (1ドル \leq i \leq n$) consists of $x_i$ pieces and has a difficulty $y_i$ (can be negative if the puzzle is very easy).

James is already very excited and would like to know in advance what he will get. Therefore, he used some of his criminal energy to gather information about the gift. In particular, he has managed to obtain an encrypted message containing the total difficulty and total number of pieces of all the puzzles that he will receive.

Now he wonders whether it is worth spending some more time to decrypt the message. After all, it might be that this information is not enough to uniquely determine his gift. Since he was never good at these computer thingies, James asked for your assistance. Help him find out whether it is worth decrypting the message or not. If the answer is negative, you have to find two distinct gifts that result in the same encrypted message.

입력

The input consists of

  • One line with an integer $n$ (2ドル \leq n \leq 4,096円$), the number of puzzles that Julia owns.
  • $n$ lines, the $i$th of which contains two integers $x_i$ and $y_i$ (1ドル \leq x_i \leq 4,096円,ドル $\left|y_i\right| \leq 4,096円$), the number of pieces of puzzle $i$ and the difficulty of puzzle $i$.

출력

If James can uniquely determine his gift, then print "yes". Otherwise, you should print "no" followed by two lines, where each line contains the description of a present. The description of a present should start with an integer $k,ドル the number of puzzles, followed by $k$ distinct integers, the indices of the puzzles.

Note that the two presents have to be distinct, meaning that there should be at least one puzzle that is contained in one present but not the other.

If there are multiple presents that result in the same encrypted message, you can print any of them.

제한

예제 입력 1

5
2 -1
3 2
3 1
1 -3
1 1

예제 출력 1

no
3 2 4 5
2 1 3

In the first sample case, the first present consists of puzzles 2ドル,ドル 4ドル,ドル and 5ドル$. The total number of pieces is 3ドル + 1 + 1 = 5$ and the total difficulty is 2ドル + (-3) + 1 = 0$. The second present consists of puzzles 1ドル$ and 3ドル$. The total number of pieces is 2ドル + 3 = 5$ and the total difficulty is $(-1) + 1 = 0$. Thus, if James only knows the total number of pieces and the total difficulty, he cannot recover his present. So it is not worth to decode the message.

예제 입력 2

4
2 -1
3 2
3 1
1 -3

예제 출력 2

yes

In the second sample case, no matter what gift Julia prepares, if James knows the total number of pieces and the total difficulty, he can recover his present. So he should decode the message.

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2024 J번

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

출처

대학교 대회

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

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