結果
問題 | No.318 学学学学学 |
ユーザー | 小指が強い人 |
提出日時 | 2015-12-11 00:46:36 |
言語 | Ruby (3.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 904 bytes |
コンパイル時間 | 265 ms |
コンパイル使用メモリ | 11,212 KB |
実行使用メモリ | 43,760 KB |
最終ジャッジ日時 | 2023-10-13 10:44:06 |
合計ジャッジ時間 | 10,671 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 189 ms
21,260 KB |
testcase_03 | RE | - |
testcase_04 | AC | 170 ms
20,744 KB |
testcase_05 | AC | 650 ms
43,760 KB |
testcase_06 | AC | 482 ms
40,472 KB |
testcase_07 | AC | 426 ms
39,792 KB |
testcase_08 | AC | 386 ms
39,152 KB |
testcase_09 | AC | 339 ms
38,824 KB |
testcase_10 | AC | 315 ms
38,192 KB |
testcase_11 | AC | 649 ms
43,740 KB |
testcase_12 | AC | 506 ms
40,536 KB |
testcase_13 | AC | 447 ms
39,968 KB |
testcase_14 | AC | 400 ms
38,996 KB |
testcase_15 | AC | 367 ms
38,632 KB |
testcase_16 | AC | 316 ms
38,460 KB |
testcase_17 | AC | 430 ms
40,680 KB |
testcase_18 | AC | 429 ms
40,152 KB |
testcase_19 | AC | 418 ms
40,756 KB |
testcase_20 | AC | 310 ms
37,696 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 81 ms
15,068 KB |
testcase_24 | AC | 80 ms
15,224 KB |
testcase_25 | AC | 82 ms
15,288 KB |
testcase_26 | AC | 82 ms
15,220 KB |
testcase_27 | AC | 79 ms
15,140 KB |
testcase_28 | AC | 81 ms
15,084 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