結果
問題 | No.318 学学学学学 |
ユーザー |
![]() |
提出日時 | 2015-12-11 00:46:36 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 904 bytes |
コンパイル時間 | 58 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 45,696 KB |
最終ジャッジ日時 | 2024-09-15 07:46:38 |
合計ジャッジ時間 | 10,687 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 192 ms
18,560 KB |
testcase_03 | RE | - |
testcase_04 | AC | 176 ms
18,048 KB |
testcase_05 | AC | 662 ms
45,696 KB |
testcase_06 | AC | 491 ms
33,408 KB |
testcase_07 | AC | 424 ms
32,768 KB |
testcase_08 | AC | 396 ms
31,872 KB |
testcase_09 | AC | 346 ms
30,976 KB |
testcase_10 | AC | 319 ms
30,592 KB |
testcase_11 | AC | 643 ms
44,416 KB |
testcase_12 | AC | 520 ms
33,408 KB |
testcase_13 | AC | 460 ms
33,408 KB |
testcase_14 | AC | 404 ms
31,488 KB |
testcase_15 | AC | 364 ms
30,336 KB |
testcase_16 | AC | 322 ms
30,720 KB |
testcase_17 | AC | 476 ms
33,024 KB |
testcase_18 | AC | 448 ms
33,152 KB |
testcase_19 | AC | 427 ms
33,152 KB |
testcase_20 | AC | 316 ms
30,848 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 83 ms
12,032 KB |
testcase_24 | AC | 85 ms
12,160 KB |
testcase_25 | AC | 81 ms
12,032 KB |
testcase_26 | AC | 81 ms
12,160 KB |
testcase_27 | AC | 82 ms
12,160 KB |
testcase_28 | AC | 86 ms
12,032 KB |
コンパイルメッセージ
Syntax OK
ソースコード
map = Struct.new(:min, :max) map2 = Struct.new(:num, :range) n = gets.to_i a = gets.split.map(&:to_i) b = Array.new(n).map{map2.new(0, map.new)} c = Hash.new d = Array.new n.times do |i| if !c.has_key?(a[i]) c[a[i]] = map.new(i, i) else c[a[i]].max = i end d.push(a[i]) end d.uniq!.sort!{|a, b| b <=> a} d.each do |x| r = c[x] t = map.new(r.min, r.max) i = r.min while i <= r.max do if b[i].num == 0 b[i].num = x b[i].range = t i += 1 else if b[i].range.min > r.min b[i].range.min = r.min end si = b[i].range.max + 1 if b[i].range.max < r.max b[i].range.max = r.max end i = si end end end sp = false b.each do |x| if sp print " " end print x.num sp = true end puts