結果
| 問題 |
No.2254 Reverse Only
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 16:02:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 794 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 81,988 KB |
| 実行使用メモリ | 159,060 KB |
| 最終ジャッジ日時 | 2025-04-16 16:08:38 |
| 合計ジャッジ時間 | 7,772 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 42 WA * 5 |
ソースコード
from collections import defaultdict
def main():
import sys
input = sys.stdin.read().split()
idx = 0
N, k = int(input[idx]), int(input[idx+1])
idx +=2
A = list(map(int, input[idx:idx+N]))
idx +=N
B = list(map(int, input[idx:idx+N]))
idx +=N
# Check if A and B are permutations
countA = defaultdict(int)
countB = defaultdict(int)
for a in A:
countA[a] +=1
for b in B:
countB[b] +=1
if countA != countB:
print("No")
return
if k ==1 or k ==2:
print("Yes")
return
if k > N:
if A == B:
print("Yes")
else:
print("No")
return
# For k >=3 and <=N, output Yes
print("Yes")
if __name__ == "__main__":
main()
lam6er