結果

問題 No.1768 The frog in the well knows the great ocean.
ユーザー puzneko
提出日時 2022-01-08 01:39:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 50,736 KB
最終ジャッジ日時 2024-11-14 09:21:57
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import stdin
q, *indata = map(int, stdin.read().split())
offset = 0
for _ in range(q):
    n = indata[offset]
    offset += 1
    a = []
    b = []
    for i in range(n):
        a.append(indata[offset+i])
        b.append(indata[offset+n+i])
    offset += n*2
    lastind = 0
    lastval = b[0]
    check = True
    for i in range(1,n):
        if lastval != b[i]:
            maxval = 0
            for j in range(lastind,i):
                maxval = max(maxval,a[j])
            if maxval != lastval:
                check = False
                break
            else:
                lastval = b[i]
                lastind = i
    if check:
        maxval = 0
        for j in range(lastind,n):
            maxval = max(maxval,a[j])
        if maxval != lastval:
            check = False
    if check:
        print("Yes")
    else:
        print("No")
0