結果
| 問題 |
No.366 ロボットソート
|
| コンテスト | |
| ユーザー |
Snark86
|
| 提出日時 | 2016-04-29 23:51:20 |
| 言語 | Python2 (2.7.18) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 334 bytes |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-10-04 19:32:37 |
| 合計ジャッジ時間 | 4,779 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 TLE * 1 |
ソースコード
n,k = map(int,raw_input().split()) a = map(int,raw_input().split()) b = [sorted(a).index(i) for i in a] cnt = 0 for i in range(n): if b[i]%k != i%k: cnt = -1 if cnt == 0: for i in range(n): while True: j = b.index(i) if i != j: cnt += 1 c = cmp(i,j) b[j], b[j+k*c] = b[j+k*c], b[j] else: break print cnt
Snark86