結果

問題 No.433 ICPC国内予選の選抜ルールがこんな感じだったらうれしい
ユーザー miraxialmiraxial
提出日時 2016-10-14 23:54:16
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 607 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 102,780 KB
最終ジャッジ日時 2024-05-01 23:29:53
合計ジャッジ時間 64,117 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 74 ms
12,160 KB
testcase_31 AC 78 ms
12,288 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 76 ms
12,288 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 179 ms
76,544 KB
testcase_44 AC 121 ms
18,176 KB
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,k=gets.split.map &:to_i
a=[]
n.times do |i|
  a<< [i]+gets.split.map(&:to_i)
end

a.sort!{|a,b|b[1]<=>a[1]}

d=Array.new(n,0)
g=[]
fase=0
base=0
loop do
  if fase==0
    g=[a.shift]
    base=g[0][1]
    fase=1
  elsif fase==1
    if a[0][1]!=base
      fase=2
    else
      g+=[a.shift]
    end
  elsif fase==2
    g.length.times do |i|
      g[i][4]=d[g[i][3]]
    end
    g.sort!{|a,b|a[2]<=>b[2]}
    g.sort!{|a,b|a[4]<=>b[4]}
    g.each do |e|
      p e[0]
      d[e[3]]+=1
      k-=1
      if k==0
        fase=3
        break
      else
        fase=0
      end
    end
  end
  break if k==0
  
end
0