結果
| 問題 | No.3324 ハイライト動画 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-01 15:38:55 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 606 ms / 2,000 ms |
| コード長 | 470 bytes |
| 記録 | |
| コンパイル時間 | 337 ms |
| コンパイル使用メモリ | 8,192 KB |
| 実行使用メモリ | 46,336 KB |
| 最終ジャッジ日時 | 2025-11-01 15:39:05 |
| 合計ジャッジ時間 | 8,026 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - in_n Main.rb:2: warning: assigned but unused variable - in_m Syntax OK
ソースコード
# frozen_string_literal: true
in_n, in_m = gets.chomp.split.map(&:to_i)
in_a = gets.chomp.split.map(&:to_i)
current_start = 0
current_last = -1
segments = []
in_a.each do |a|
if current_last + 1 == a
current_last += 1
else
segments << [current_start, current_last] if current_last != -1
current_start = a
current_last = a
end
end
segments << [current_start, current_last]
puts segments.size
segments.each { |s, l| puts [s, l - s + 1].join(" ") }