結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
👑 |
提出日時 | 2021-07-26 22:12:09 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 787 bytes |
コンパイル時間 | 162 ms |
コンパイル使用メモリ | 5,248 KB |
実行使用メモリ | 110,676 KB |
最終ジャッジ日時 | 2024-07-22 13:13:49 |
合計ジャッジ時間 | 82,245 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 12 TLE * 8 |
ソースコード
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 n = io.read("*n", "*l") local str = io.read() local a = {} for w in str:gmatch("%d+") do table.insert(a, lltonumber(w)) end local ret = 1LL local t = {} for i = 1, n do t[i] = {} local ai = a[i] for j = 1, 60 do t[i][j] = ai % 2LL == 1LL ai = ai / 2LL end end for j = 1, 60 do for i = 1, n do if t[i][j] then ret = ret + ret for k = i + 1, n do for l = j, 60 do if t[i][l] then t[k][l] = not t[k][l] end end end for k = j, 60 do t[i][k] = false end break end end end ret = tostring(ret):gsub("LL", "") print(ret)