結果
| 問題 | No.1425 Yet Another Cyclic Shifts Sorting |
| コンテスト | |
| ユーザー |
siman
|
| 提出日時 | 2021-03-18 05:02:32 |
| 言語 | Ruby (4.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 300 bytes |
| 記録 | |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 8,832 KB |
| 実行使用メモリ | 47,256 KB |
| 最終ジャッジ日時 | 2026-05-11 01:00:09 |
| 合計ジャッジ時間 | 11,286 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 39 |
コンパイルメッセージ
Syntax OK
ソースコード
N = gets.to_i
A = gets.split.map(&:to_i)
B = A.sort.reverse
P = Hash.new { |h, k| h[k] = [] }
d = 0
ans = 0
A.each_with_index do |a, i|
P[a] << i
end
B.each_with_index do |b, i|
idx = (P[b].pop - d) % (N - i + 1)
col = N - i - 1
next if idx == col
d += idx + 1
ans += 1
end
puts ans
siman