結果
問題 | No.447 ゆきこーだーの雨と雪 (2) |
ユーザー |
👑 |
提出日時 | 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 |
ソースコード
local ior = io.input()local n = ior:read("*n")local level, clearCount = {}, {}for i = 1, n dolevel[i] = ior:read("*n")clearCount[i] = 0endlocal eps = 1.0e-6local function getscore(pNo)local tmp = clearCount[pNo] + 1clearCount[pNo] = tmpreturn math.floor(eps + 50 * level[pNo] * (1 + 1 / (0.8 + 0.2 * tmp)))endlocal Hito = {}Hito.setScore = function(self, problemNo, time)local score = getscore(problemNo)self.score[problemNo] = scoreself.totscore = self.totscore + scoreself.time = timeendHito.dump = function(self, rank)io.write(rank .. " " .. self.name)for i = 1, n doio.write(" " .. self.score[i])endio.write(" " .. self.totscore .. "\n")endlocal function Hitolt(x, y)if(x.totscore == y.totscore) thenreturn x.time < y.timeelsereturn x.totscore > y.totscoreendendHito.new = function(name)local obj = {}obj.name = nameobj.score = {}for i = 1, n do obj.score[i] = 0 endobj.totscore = 0obj.time = -1setmetatable(obj, {__index = Hito, __lt = Hitolt})return objendlocal hitolist = {}local hitomap = {}local datanum = ior:read("*n", "*l")for i = 1, datanum dolocal txt = ior:read()local name, p = txt:match("(%w+) (%w)")local problemNo = string.byte(p) - 64if(hitomap[name] == nil) thentable.insert(hitolist, Hito.new(name))hitomap[name] = #hitolistendhitolist[hitomap[name]]:setScore(problemNo, i)endtable.sort(hitolist)for i = 1, #hitolist dohitolist[i]:dump(i)end