結果

問題 No.628 Tagの勢い
ユーザー nobigomu
提出日時 2018-05-24 12:18:36
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 6,816 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 22:49:12
合計ジャッジ時間 838 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

(function (f)
	local a=f()
	for i=1,#a do
		io.write(a[i][1]," ",a[i][2],"\n")
		if i==10 then break end
	end
end)(function ()
	local a,h,i={},{},1
	for _=1,tonumber(io.stdin:read("*l")) do
		io.stdin:read("*l")
		local t=tonumber(io.stdin:read("*l"):match("%s(%d+)"))
		for e in io.stdin:read("*l"):gmatch("%w+") do
			if h[e]==nil then a[i],h[e],i={e,0},i,i+1 end a[h[e]][2]=a[h[e]][2]+t
		end
	end
	table.sort(a,function (a,b) return a[2]==b[2] and a[1]<b[1] or a[2]>b[2] end)
	return a
end)
0