結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー 👑 obakyanobakyan
提出日時 2019-05-12 23:01:06
言語 Lua
(LuaJit 2.1.1696795921)
結果
WA  
実行時間 -
コード長 1,499 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 4,700 KB
最終ジャッジ日時 2023-09-19 06:36:58
合計ジャッジ時間 2,792 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

local ior = io.input()
local n = ior:read("*n")
local level, clearCount = {}, {}
for i = 1, n do
  level[i] = ior:read("*n")
  clearCount[i] = 0
end

local function getscore(pNo)
  local tmp = clearCount[pNo] + 1
  clearCount[pNo] = tmp
  return math.floor(50 * level[pNo] * (1 + 1 / (0.8 + 0.2 * tmp)))
end

local Hito = {}
Hito.setScore = function(self, problemNo, time)
  local score = getscore(problemNo)
  self.score[problemNo] = score
  self.totscore = self.totscore + score
  self.time = time
end
Hito.dump = function(self, rank)
  io.write(rank .. " " .. self.name)
  for i = 1, n do
    io.write(" " .. self.score[i])
  end
  io.write(" " .. self.totscore .. "\n")
end

local function Hitolt(x, y)
  if(x.totscore == y.totscore) then
    return x.time < y.time
  else
    return x.totscore > y.totscore
  end
end

Hito.new = function(name)
  local obj = {}
  obj.name = name
  obj.score = {}
  for i = 1, n do obj.score[i] = 0 end
  obj.totscore = 0
  obj.time = -1
  setmetatable(obj, {__index = Hito, __lt = Hitolt})
  return obj
end

local hitolist = {}
local hitomap = {}
local datanum = ior:read("*n", "*l")
for i = 1, datanum do
  local txt = ior:read()
  print(txt)
  local name, p = txt:match("(%w+) (%w)")
  local problemNo = string.byte(p) - 64
  if(hitomap[name] == nil) then
    table.insert(hitolist, Hito.new(name))
    hitomap[name] = #hitolist
  end
  hitolist[hitomap[name]]:setScore(problemNo, i)
end
table.sort(hitolist)
for i = 1, #hitolist do
  hitolist[i]:dump(i)
end
0