結果
問題 | No.2518 Adjacent Larger |
ユーザー | hato336 |
提出日時 | 2023-10-28 09:14:25 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 958 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 116,740 KB |
最終ジャッジ日時 | 2023-10-28 09:14:33 |
合計ジャッジ時間 | 7,250 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 124 ms
85,060 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 186 ms
89,744 KB |
testcase_07 | AC | 193 ms
90,212 KB |
testcase_08 | AC | 186 ms
89,748 KB |
testcase_09 | AC | 186 ms
89,752 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 165 ms
89,116 KB |
testcase_14 | WA | - |
testcase_15 | AC | 154 ms
89,144 KB |
testcase_16 | AC | 172 ms
116,696 KB |
testcase_17 | AC | 158 ms
103,164 KB |
testcase_18 | AC | 158 ms
103,172 KB |
testcase_19 | AC | 155 ms
101,140 KB |
testcase_20 | AC | 162 ms
107,772 KB |
testcase_21 | AC | 169 ms
116,448 KB |
testcase_22 | AC | 161 ms
116,448 KB |
testcase_23 | AC | 178 ms
116,740 KB |
testcase_24 | AC | 169 ms
116,620 KB |
testcase_25 | AC | 166 ms
116,708 KB |
testcase_26 | AC | 165 ms
116,704 KB |
testcase_27 | AC | 174 ms
116,728 KB |
testcase_28 | AC | 175 ms
116,712 KB |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random #sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #alist = [] #s = input() t = int(input()) for _ in range(t): n = int(input()) alist = list(map(int,input().split())) if sum(alist) != n: print('No') continue c = 0 for i in range(n): if alist[i] == 2: if alist[i-1] == 2 or alist[(i+1)%n] == 2: print('No') c = 1 break if alist[i] == 1: if alist[i-1] == 2 and alist[(i+1)%n] == 2: print('No') c = 1 break if alist[i] == 0: if alist[i-1] == 0 or alist[(i+1)%n] == 0: print('No') c = 1 break if alist.count(2) == 0 or alist.count(0) == 0: print('No') c = 1 if not c: print('Yes')