結果
問題 | No.2518 Adjacent Larger |
ユーザー | miya145592 |
提出日時 | 2023-10-27 23:08:24 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 935 bytes |
コンパイル時間 | 1,274 ms |
コンパイル使用メモリ | 81,456 KB |
実行使用メモリ | 101,720 KB |
最終ジャッジ日時 | 2023-10-27 23:08:29 |
合計ジャッジ時間 | 3,657 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
53,368 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 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 76 ms
101,652 KB |
testcase_17 | AC | 61 ms
85,640 KB |
testcase_18 | AC | 60 ms
83,620 KB |
testcase_19 | AC | 57 ms
81,512 KB |
testcase_20 | WA | - |
testcase_21 | AC | 67 ms
97,112 KB |
testcase_22 | AC | 64 ms
96,968 KB |
testcase_23 | AC | 88 ms
101,720 KB |
testcase_24 | AC | 71 ms
99,472 KB |
testcase_25 | AC | 71 ms
99,640 KB |
testcase_26 | AC | 75 ms
101,704 KB |
testcase_27 | AC | 70 ms
99,584 KB |
testcase_28 | AC | 71 ms
99,568 KB |
ソースコード
import sys input = sys.stdin.readline T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) in_deg = [0 for _ in range(N)] flag = True for i in range(N): pre = (i-1)%N nxt = (i+1)%N if A[i]==2: in_deg[pre]+=1 in_deg[nxt]+=1 elif A[i]==1: if in_deg[pre]+A[pre]>=2: if in_deg[nxt]+A[nxt]>=2: flag = False break else: in_deg[nxt]+=1 else: in_deg[pre]+=1 for i in range(N): if A[i]+in_deg[i]!=2: flag = False break if flag: flag = False for i in range(N): if A[i]!=1: flag = True break if flag: print("Yes") else: print("No") else: print("No")