結果

問題 No.3109 Swap members
ユーザー toma
提出日時 2025-04-18 22:20:17
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 485 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 24,704 KB
最終ジャッジ日時 2025-04-18 22:20:32
合計ジャッジ時間 13,666 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 52
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
s = []
t = []

for i in range(n):
    s.append(input())

for i in range(n):
    t.append(input())

possible = True
for i in range(k):
    s_group = []
    t_group = []
    for j in range(i, n, k):
        s_group.append(s[j])
        t_group.append(t[j])
    
    if sorted(s_group) != sorted(t_group):
        possible = False
        break

print("Yes" if possible else "No")
0