結果

問題 No.1768 The frog in the well knows the great ocean.
ユーザー kutsutama
提出日時 2021-11-30 12:38:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,296 KB
実行使用メモリ 97,132 KB
最終ジャッジ日時 2024-07-03 06:54:02
合計ジャッジ時間 5,659 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    a = [int(x) for x in input().split()]
    b = [int(x) for x in input().split()]

    ok = True
    l = 0
    r = 0
    while l < n:
        for i in range(l, n - 1):
            if b[i + 1] != b[i]:
                r = i
                break
            r = i + 1
        aMax = max(a[l:(r + 1)])
        if aMax != b[l]:
            ok = False
            break
        l = r + 1
        r = l
    if ok:
        print("Yes")
    else:
        print("No")
0