結果

問題 No.1768 The frog in the well knows the great ocean.
ユーザー ああいいああいい
提出日時 2022-03-12 00:55:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 808 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 115,576 KB
最終ジャッジ日時 2023-10-14 10:13:12
合計ジャッジ時間 7,530 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,048 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 143 ms
115,576 KB
testcase_13 WA -
testcase_14 AC 142 ms
115,240 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 151 ms
109,760 KB
testcase_20 AC 152 ms
109,980 KB
testcase_21 AC 73 ms
71,412 KB
testcase_22 AC 74 ms
71,204 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 146 ms
110,240 KB
testcase_27 AC 71 ms
71,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def calc(A,B):

    N = len(A)
    now = A[0]
    right = 0
    for left in range(N):
        if A[right] > B[left]:
            return False
        if (left > 0 and A[left-1] == B[left]) or A[left] == B[left]:
            if right == left:
                right += 1
            continue
        while right < N and A[right] != B[left]:
            if A[right] > B[left]:
                return False
            right += 1
        if right == N:
            return False
        for j in range(left,right):
            A[j] = B[left]
        if right == left:
            right += 1
    return True

for _ in range(T):
    N = int(input())
    A = list(map(int,input().split()))
    B = list(map(int,input().split()))
    if calc(A,B):
        print('Yes')
    else:
        print('No')
0