結果

問題 No.1768 The frog in the well knows the great ocean.
ユーザー tktk_snsntktk_snsn
提出日時 2021-11-26 23:42:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 850 bytes
コンパイル時間 312 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 37,796 KB
最終ジャッジ日時 2023-09-12 06:02:46
合計ジャッジ時間 5,123 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,540 KB
testcase_01 AC 24 ms
8,728 KB
testcase_02 AC 25 ms
8,708 KB
testcase_03 AC 25 ms
8,952 KB
testcase_04 AC 25 ms
8,804 KB
testcase_05 AC 25 ms
8,864 KB
testcase_06 AC 160 ms
22,184 KB
testcase_07 AC 159 ms
26,188 KB
testcase_08 AC 152 ms
23,016 KB
testcase_09 AC 141 ms
21,612 KB
testcase_10 AC 156 ms
26,900 KB
testcase_11 AC 180 ms
27,552 KB
testcase_12 AC 173 ms
27,692 KB
testcase_13 AC 163 ms
27,684 KB
testcase_14 AC 150 ms
27,836 KB
testcase_15 AC 166 ms
27,744 KB
testcase_16 AC 201 ms
37,736 KB
testcase_17 AC 201 ms
37,736 KB
testcase_18 AC 202 ms
37,796 KB
testcase_19 AC 164 ms
37,760 KB
testcase_20 AC 168 ms
37,708 KB
testcase_21 AC 19 ms
8,536 KB
testcase_22 AC 19 ms
8,480 KB
testcase_23 AC 21 ms
8,624 KB
testcase_24 WA -
testcase_25 AC 155 ms
35,508 KB
testcase_26 AC 132 ms
35,492 KB
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)


def RunLengthEncoding(S):
    res = []
    N = len(S)
    i = 0
    while i < N:
        cnt = 1
        while i < N - 1 and S[i] == S[i + 1]:
            cnt += 1
            i += 1
        res.append(S[i])
        i += 1
    return res


def F(N, A, B):
    if not set(A).issuperset(set(B)):
        return False
    for i in range(N):
        if A[i] > B[i]:
            return False

    i = 0
    for b in B:
        while i < N and b != A[i]:
            i += 1
        if i >= N:
            return False
    return True


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