結果
| 問題 |
No.482 あなたの名は
|
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-05-07 22:12:35 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 265 ms / 2,000 ms |
| コード長 | 330 bytes |
| コンパイル時間 | 118 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 40,892 KB |
| 最終ジャッジ日時 | 2024-07-03 09:35:25 |
| 合計ジャッジ時間 | 5,764 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
D=[int(i) for i in input().split()]
P=dict()
for i,d in enumerate(D):
P[d]=i
ct=0
for i in range(n):
if D[i]==i+1:
continue
else:
ct+=1
D[P[i+1]]=D[i]
P[D[i]]=P[i+1]
if ct<=k and ct%2==k%2:
print("YES")
else:
print("NO")
takakin