結果

問題 No.447 ゆきこーだーの雨と雪 (2)
ユーザー 👑 obakyanobakyan
提出日時 2019-05-12 23:07:00
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,510 bytes
コンパイル時間 32 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 18:53:53
合計ジャッジ時間 1,326 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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 eps = 1.0e-6
local function getscore(pNo)
local tmp = clearCount[pNo] + 1
clearCount[pNo] = tmp
return math.floor(eps + 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()
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
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0