結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,344 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,336 KB
testcase_13 WA -
testcase_14 AC 142 ms
115,568 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 148 ms
109,720 KB
testcase_20 AC 147 ms
109,904 KB
testcase_21 AC 79 ms
71,068 KB
testcase_22 AC 73 ms
71,336 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 144 ms
110,120 KB
testcase_27 AC 70 ms
71,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

def calc(A,B):

    N = len(A)
    now = A[0]
    right = 0
    for left in range(N):
        if A[left] > 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