結果

問題 No.1768 The frog in the well knows the great ocean.
ユーザー puznekopuzneko
提出日時 2022-01-08 01:39:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 869 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 50,676 KB
最終ジャッジ日時 2024-04-26 19:10:05
合計ジャッジ時間 7,372 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,624 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 AC 224 ms
50,416 KB
testcase_13 WA -
testcase_14 AC 224 ms
50,548 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 236 ms
48,240 KB
testcase_20 AC 231 ms
48,112 KB
testcase_21 AC 29 ms
10,624 KB
testcase_22 AC 28 ms
10,752 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 278 ms
42,220 KB
testcase_27 AC 28 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

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