結果
問題 |
No.366 ロボットソート
|
ユーザー |
|
提出日時 | 2016-04-29 22:59:28 |
言語 | Python2 (2.7.18) |
結果 |
RE
|
実行時間 | - |
コード長 | 415 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 13,440 KB |
最終ジャッジ日時 | 2024-10-04 18:39:40 |
合計ジャッジ時間 | 8,164 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 RE * 1 TLE * 1 |
ソースコード
# -*- coding: utf-8 -*- import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll N, K = map(int, raw_input().split()) a = map(int, raw_input().split()) i = ans = 0 while i < N - K: if a[i] > a[i + K]: a[i], a[i + K] = a[i + K], a[i] ans += 1 i = 0 else: i += 1 if min(a[i + 1] - a[i] for i in xrange(N - 1)) >= 1: print ans else: print -1