結果
問題 | No.366 ロボットソート |
ユーザー |
![]() |
提出日時 | 2019-12-21 20:43:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 272 ms / 2,000 ms |
コード長 | 260 bytes |
コンパイル時間 | 102 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-21 16:13:09 |
合計ジャッジ時間 | 2,229 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
N, K = map(int, input().split()) a = list(map(int, input().split())) b = sorted(a) s = 0 for i in reversed(range(K, N)): for j in range(i-K+1): if a[j] > a[j+K]: a[j], a[j+K] = a[j+K], a[j] s += 1 print(s if a == b else -1)