結果
| 問題 | No.1768 The frog in the well knows the great ocean. |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-12 00:56:17 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 807 bytes |
| 記録 | |
| コンパイル時間 | 525 ms |
| コンパイル使用メモリ | 85,376 KB |
| 実行使用メモリ | 124,032 KB |
| 最終ジャッジ日時 | 2026-04-05 10:21:33 |
| 合計ジャッジ時間 | 3,665 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 WA * 19 |
ソースコード
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')