結果
問題 | No.2518 Adjacent Larger |
ユーザー | lloyz |
提出日時 | 2023-10-28 21:18:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,224 bytes |
コンパイル時間 | 303 ms |
コンパイル使用メモリ | 81,860 KB |
実行使用メモリ | 103,072 KB |
最終ジャッジ日時 | 2023-10-28 21:18:28 |
合計ジャッジ時間 | 4,665 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,600 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 53 ms
70,316 KB |
testcase_12 | AC | 54 ms
72,360 KB |
testcase_13 | AC | 58 ms
72,696 KB |
testcase_14 | AC | 58 ms
70,316 KB |
testcase_15 | AC | 54 ms
72,360 KB |
testcase_16 | AC | 80 ms
101,412 KB |
testcase_17 | AC | 63 ms
85,464 KB |
testcase_18 | AC | 65 ms
85,552 KB |
testcase_19 | AC | 62 ms
81,016 KB |
testcase_20 | AC | 69 ms
90,632 KB |
testcase_21 | AC | 74 ms
100,564 KB |
testcase_22 | AC | 74 ms
100,564 KB |
testcase_23 | AC | 81 ms
101,520 KB |
testcase_24 | AC | 77 ms
101,252 KB |
testcase_25 | AC | 77 ms
102,296 KB |
testcase_26 | AC | 79 ms
102,312 KB |
testcase_27 | AC | 77 ms
103,072 KB |
testcase_28 | AC | 81 ms
101,508 KB |
ソースコード
for _ in range(int(input())): n = int(input()) A = list(map(int, input().split())) if n == 2: if A == [1, 0] or A == [0, 1]: print("Yes") else: print("No") else: zero = False two = False f = -1 for i in range(n): if A[i] == 0: f = i break if f == -1: print("No") continue A = A[f:] + A[:f] flag = True zero = True two = False for i in range(1, n): a = A[i] if a == 0: if not two: flag = False break two = False if zero: flag = False break else: zero = True elif a == 1: zero = False elif a == 2: zero = False if two: flag = False break else: two = True if A[0] == A[-1]: flag = False if flag: print("Yes") else: print("No")