結果

問題 No.2372 既視感
ユーザー KowerKoint2010
提出日時 2023-06-28 08:16:17
言語 Ruby
(3.4.1)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 558 bytes
コンパイル時間 33 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 14,464 KB
最終ジャッジ日時 2024-07-05 00:31:00
合計ジャッジ時間 3,437 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, k, q = gets.split.map(&:to_i)
a = []
q.times do
  op = gets.to_i
  if op == 1
    s = gets.chomp
    a << s
  else
    t = []
    d = []
    6.times do
      ti, di = gets.split
      t << ti
      d << di.to_i
    end
    ans = 0
    solve_duaration = 0
    while ans < 6
      if a != nil and a[-[n,a.length].min..-1].include?(t[ans])
        solve_duaration += [d[ans], k].min
      else
        solve_duaration += d[ans]
      end
      if solve_duaration > 60
        break
      end
      ans += 1
    end
    puts ans
    a += t[0...ans]
  end
end
0