結果
問題 |
No.571 3人兄弟(その2)
|
ユーザー |
![]() |
提出日時 | 2025-04-30 00:16:31 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 396 ms |
コンパイル使用メモリ | 7,936 KB |
実行使用メモリ | 12,928 KB |
最終ジャッジ日時 | 2025-04-30 00:16:33 |
合計ジャッジ時間 | 2,663 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
コンパイルメッセージ
Syntax OK
ソースコード
class Main Brother = Struct.new(:i, :h, :w) def start brothers = input_term brothers = sort_term(brothers) echo brothers.map { |x| x.i }.join("\n") self.class.send(:remove_const, :Brother) return nil end private def sort_term(brothers) brothers.sort_by! { |x| x.w }.reverse! i = 0 brothers.sort_by! { |x| [-x.h, i += 1] }.reverse! brothers end def input_term a = [] for i in 0...3 h, w = input.split brother = Brother.new(("A".ord + i).chr, h, w) a += [brother] end return a end def echo(*x) print(*x) puts end def input = gets.chomp end Main.new.start