結果

問題 No.2518 Adjacent Larger
ユーザー tassei903tassei903
提出日時 2023-10-27 22:17:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 718 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 98,492 KB
最終ジャッジ日時 2023-10-27 22:17:12
合計ジャッジ時間 3,409 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,576 KB
testcase_01 AC 105 ms
76,396 KB
testcase_02 AC 117 ms
77,248 KB
testcase_03 AC 108 ms
76,472 KB
testcase_04 AC 105 ms
76,396 KB
testcase_05 AC 104 ms
76,564 KB
testcase_06 AC 75 ms
76,324 KB
testcase_07 AC 75 ms
76,396 KB
testcase_08 AC 95 ms
76,280 KB
testcase_09 AC 65 ms
73,216 KB
testcase_10 AC 74 ms
76,308 KB
testcase_11 AC 49 ms
68,224 KB
testcase_12 AC 49 ms
70,272 KB
testcase_13 AC 50 ms
70,288 KB
testcase_14 AC 48 ms
68,224 KB
testcase_15 AC 49 ms
70,272 KB
testcase_16 AC 76 ms
98,312 KB
testcase_17 AC 59 ms
80,724 KB
testcase_18 AC 60 ms
80,752 KB
testcase_19 AC 58 ms
78,792 KB
testcase_20 AC 66 ms
87,256 KB
testcase_21 AC 69 ms
95,840 KB
testcase_22 AC 72 ms
95,840 KB
testcase_23 AC 101 ms
98,348 KB
testcase_24 AC 72 ms
96,172 KB
testcase_25 AC 75 ms
98,492 KB
testcase_26 AC 75 ms
98,492 KB
testcase_27 AC 72 ms
98,344 KB
testcase_28 AC 72 ms
98,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
for _ in range(ni()):
    n = ni()
    a = na()
    if not (0 in a and 2 in a):
        No()
        continue
    
    x = a.index(2)
    z = 2
    x = (x+1) % n
    for i in range(n):
        if a[x] == z:
            No()
            break
        elif a[x] == 1:
            pass
        else:
            z = a[x]
        x = (x + 1) % n
    else:
        Yes()
0