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

28006번 - LaLa and Lamp 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 1024 MB247787.500%

문제

When $\color{blue}{\text{LaLa}}$ laid down on her pet $\color{brown}{\text{Leo}}$'s back to fall asleep, she noticed that the lamp is all messed up, which must have been the act of her sister $\color{purple}{\text{LiLi}}$.

The lamp can be modeled as a regular triangular grid where each cell contains a bulb which is either on or off.

$\color{blue}{\text{LaLa}}$ wants to turn off the lamp (that is, set the state of all bulbs to off). $\color{blue}{\text{LaLa}}$ can pick any of the three directions parallel to the side of a lamp, pick any row parallel to that direction, and then flip the state of all the bulbs in the row (on to off and off to on) with her $\color{red}{\text{m}} \color{brown}{\text{a}} \color{orange}{\text{g}} \color{blue}{\text{i}} \color{magenta} {\text{c}}$. $\color{blue}{\text{LaLa}}$ also could just walk over to the lamp and manually turn every bulb off, but she would prefer not to.

Write a program that determines whether $\color{blue}{\text{LaLa}}$ can turn off the lamp with her $\color{red}{\text{m}} \color{brown}{\text{a}} \color{orange}{\text{g}} \color{blue}{\text{i}} \color{magenta} {\text{c}}$.

입력

The input is given in the following format:

$N$

$S_0$

$S_1$

$\vdots$

$S_{N-1}$

where $N$ is the number of bulbs in a side of the lamp, and $S_i$ is the binary string of length $i+1$ representing the initial states of bulbs in the $i$-th row, where the $j$-th character of $S_i$ is '1' if and only if the $j$-th bulb is on.

The input satisfies the following constraint:

  • $N$ is an integer.
  • 2ドル \le N \le 2,000円$

출력

If $\color{blue}{\text{LaLa}}$ can turn off the lamp with $\color{red}{\text{m}} \color{brown}{\text{a}} \color{orange}{\text{g}} \color{blue}{\text{i}} \color{magenta} {\text{c}},ドル print a single string "Yes". Otherwise, print a single string "No". You may print each character in either case (lower or upper).

제한

예제 입력 1

6
0
00
000
0110
00100
000000

예제 출력 1

Yes

노트

The following illustrates a sequence of $\color{red}{\text{m}} \color{brown}{\text{a}} \color{orange}{\text{g}} \color{blue}{\text{i}} \color{magenta} {\text{c}}$ $\color{blue}{\text{LaLa}}$ should cast to turn off the lamp given in the sample. Empty circles denote the bulbs that are off, yellow circles denote the bulbs that are on, and red line is the choosen row for $\color{red}{\text{m}} \color{brown}{\text{a}} \color{orange}{\text{g}} \color{blue}{\text{i}} \color{magenta} {\text{c}}$.

Step 0 Step 1 Step 2
Step 3 Step 4 Step 5
Step 6

출처

Camp > Osijek Competitive Programming Camp > Winter 2023 > Day 9: Magical Story of LaLa C번

  • 문제를 만든 사람: aeren
(追記) (追記ここまで)

출처

대학교 대회

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

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