結果

問題 No.709 優勝可能性
ユーザー 👑 obakyanobakyan
提出日時 2022-05-01 19:04:33
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 391 ms / 3,500 ms
コード長 694 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 5,220 KB
実行使用メモリ 12,500 KB
最終ジャッジ日時 2023-09-13 11:43:50
合計ジャッジ時間 5,812 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 122 ms
4,376 KB
testcase_11 AC 71 ms
4,376 KB
testcase_12 AC 216 ms
4,376 KB
testcase_13 AC 265 ms
4,456 KB
testcase_14 AC 237 ms
4,376 KB
testcase_15 AC 246 ms
4,380 KB
testcase_16 AC 290 ms
5,840 KB
testcase_17 AC 391 ms
12,500 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 265 ms
4,380 KB
testcase_21 AC 264 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, m = io.read("*n", "*n")
local cnt = {}
for i = 1, n do
  cnt[i] = 0
end
local score, name = {}, {}
for i = 1, m do
  score[i] = 0
  name[i] = {}
end
local ret = 0
for i = 1, n do
  for j = 1, m do
    local rij = io.read("*n")
    if score[j] == rij then
      table.insert(name[j], i)
      cnt[i] = cnt[i] + 1
      if cnt[i] == 1 then
        ret = ret + 1
      end
    elseif score[j] < rij then
      for k = 1, #name[j] do
        local z = name[j][k]
        cnt[z] = cnt[z] - 1
        if cnt[z] == 0 then ret = ret - 1 end
      end
      score[j] = rij
      name[j] = {i}
      cnt[i] = cnt[i] + 1
      if cnt[i] == 1 then ret = ret + 1 end
    end
  end
  print(ret)
end
0