結果
問題 |
No.1768 The frog in the well knows the great ocean.
|
ユーザー |
![]() |
提出日時 | 2021-11-26 23:42:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 850 bytes |
コンパイル時間 | 125 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 38,408 KB |
最終ジャッジ日時 | 2024-06-29 19:07:30 |
合計ジャッジ時間 | 5,390 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 25 WA * 2 |
ソースコード
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")