結果
問題 |
No.2254 Reverse Only
|
ユーザー |
![]() |
提出日時 | 2025-03-20 20:24:29 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 834 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 82,552 KB |
実行使用メモリ | 159,544 KB |
最終ジャッジ日時 | 2025-03-20 20:26:20 |
合計ジャッジ時間 | 9,159 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 42 WA * 5 |
ソースコード
import sys from collections import defaultdict def main(): input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx +=1 k = int(input[idx]) idx +=1 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 have the same elements count_A = defaultdict(int) count_B = defaultdict(int) for a in A: count_A[a] +=1 for b in B: count_B[b] +=1 if count_A != count_B: print("No") return if k ==1: print("Yes") return if k > N: if A == B: print("Yes") else: print("No") return # If k <=N, then answer is Yes because it's possible. print("Yes") if __name__ == "__main__": main()