結果

問題 No.1972 Modulo Set
ユーザー 👑 obakyanobakyan
提出日時 2022-06-11 00:36:42
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 7,396 KB
最終ジャッジ日時 2024-04-15 08:55:55
合計ジャッジ時間 2,260 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 8 ms
6,940 KB
testcase_04 AC 11 ms
6,944 KB
testcase_05 AC 12 ms
6,940 KB
testcase_06 AC 17 ms
6,944 KB
testcase_07 AC 25 ms
6,944 KB
testcase_08 AC 13 ms
6,944 KB
testcase_09 AC 3 ms
6,944 KB
testcase_10 AC 10 ms
6,940 KB
testcase_11 AC 25 ms
6,940 KB
testcase_12 AC 6 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 4 ms
6,944 KB
testcase_15 AC 27 ms
6,940 KB
testcase_16 AC 27 ms
6,944 KB
testcase_17 AC 12 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 26 ms
6,940 KB
testcase_20 AC 30 ms
6,944 KB
testcase_21 AC 13 ms
6,940 KB
testcase_22 AC 22 ms
6,940 KB
testcase_23 AC 42 ms
7,216 KB
testcase_24 AC 16 ms
6,940 KB
testcase_25 AC 24 ms
6,940 KB
testcase_26 AC 34 ms
6,944 KB
testcase_27 AC 51 ms
7,308 KB
testcase_28 AC 17 ms
6,940 KB
testcase_29 AC 23 ms
6,940 KB
testcase_30 AC 35 ms
7,304 KB
testcase_31 AC 4 ms
6,940 KB
testcase_32 AC 27 ms
6,940 KB
testcase_33 AC 49 ms
7,372 KB
testcase_34 AC 48 ms
7,396 KB
testcase_35 AC 47 ms
7,392 KB
testcase_36 AC 48 ms
7,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, m = io.read("*n", "*n")
local t = {}
for i = 1, n do
  local a = io.read("*n") % m
  if t[a] then
    t[a] = t[a] + 1
  else
    t[a] = 1
  end
end
local r = 0
for k, v in pairs(t) do
  if k == 0 then
    r = r + 1
  else
    local inv = m - k
    if t[inv] then
      if v == t[inv] then
        if k == inv then
          r = r + 1
        elseif k < inv then
          r = r + v
        end
      elseif t[inv] < v then
        r = r + v
      end
    else
      r = r + v
    end
  end
end
print(r)
0