結果

問題 No.1673 Lamps on a line
ユーザー 👑 obakyanobakyan
提出日時 2021-09-10 23:20:09
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 5,356 KB
実行使用メモリ 6,280 KB
最終ジャッジ日時 2023-09-02 21:47:57
合計ジャッジ時間 1,717 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 41 ms
4,372 KB
testcase_03 AC 40 ms
4,368 KB
testcase_04 AC 71 ms
4,372 KB
testcase_05 AC 5 ms
4,372 KB
testcase_06 AC 60 ms
4,372 KB
testcase_07 AC 67 ms
6,280 KB
testcase_08 AC 6 ms
6,168 KB
testcase_09 AC 93 ms
4,368 KB
testcase_10 AC 102 ms
4,368 KB
testcase_11 AC 11 ms
4,368 KB
testcase_12 AC 89 ms
6,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, q = io.read("*n", "*n")
local t = {}
for i = 1, n do t[i] = 0 end
local c = 0
for iq = 1, q do
  local l, r = io.read("*n", "*n")
  for i = l, r do
    if t[i] == 1 then
      c = c - 1
    else
      c = c + 1
    end
    t[i] = 1 - t[i]
  end
  print(c)
end
0