結果
| 問題 |
No.2110 012 Matching
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-10-29 00:56:16 |
| 言語 | Lua (LuaJit 2.1.1734355927) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 830 bytes |
| コンパイル時間 | 59 ms |
| コンパイル使用メモリ | 6,940 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 03:56:24 |
| 合計ジャッジ時間 | 2,817 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 11 |
ソースコード
local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]
local function lltonumber(str)
return C.atoll(str)
end
local function llmin(x, y) return x < y and x or y end
local q = io.read("*n", "*l")
for iq = 1, q do
local a, b, c = io.read():match("(%d+) (%d+) (%d+)")
a = lltonumber(a)
b = lltonumber(b)
c = lltonumber(c)
d = llmin(a, c)
s = 2LL * d
a = a - d
c = c - d
if b % 2LL == 1LL then
s = s + b - 1LL
b = 1LL
else
s = s + b
b = 0LL
end
if 0LL == a then
if (a + b) % 2LL == 0 then
z = a + b * 2LL - (a + b) / 2LL * 3LL
s = s + z
else
if a == 1LL then
s = s + b / 2LL
else
s = s + (b - 1LL) / 2LL
end
end
else
s = s + llmin(a, b)
end
s = tostring(s):gsub("LL", "")
print(s)
end