結果
問題 | No.2085 Directed Complete Graph |
ユーザー | 👑 obakyan |
提出日時 | 2022-09-27 22:49:13 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 167 ms / 2,000 ms |
コード長 | 974 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 5,380 KB |
実行使用メモリ | 24,372 KB |
平均クエリ数 | 2533.76 |
最終ジャッジ日時 | 2023-08-24 04:10:58 |
合計ジャッジ時間 | 3,771 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
24,372 KB |
testcase_01 | AC | 24 ms
23,388 KB |
testcase_02 | AC | 157 ms
23,896 KB |
testcase_03 | AC | 152 ms
24,004 KB |
testcase_04 | AC | 167 ms
24,340 KB |
testcase_05 | AC | 87 ms
23,616 KB |
testcase_06 | AC | 93 ms
24,024 KB |
testcase_07 | AC | 162 ms
24,324 KB |
testcase_08 | AC | 122 ms
23,376 KB |
testcase_09 | AC | 160 ms
23,832 KB |
testcase_10 | AC | 165 ms
23,392 KB |
testcase_11 | AC | 165 ms
24,232 KB |
testcase_12 | AC | 165 ms
23,680 KB |
testcase_13 | AC | 165 ms
24,316 KB |
testcase_14 | AC | 164 ms
23,404 KB |
testcase_15 | AC | 23 ms
23,520 KB |
testcase_16 | AC | 23 ms
24,300 KB |
ソースコード
local gc = 0 local t = {} local function query(a, b) io.write("? " .. a .. " " .. b .. "\n") io.flush() -- do -- gc = gc + 1 -- if b == t[1] then return false end -- if a == t[#t] then return false end -- return false -- end local ret = io.read("*l") return tonumber(ret) == 1 end local n = io.read("*n", "*l") local f = query(1, 2) if f then table.insert(t, 1) table.insert(t, 2) else table.insert(t, 2) table.insert(t, 1) end for i = 3, n do if false and query(i, t[1]) then table.insert(t, 1, i) elseif false and query(t[#t], i) then table.insert(t, i) else local left, right = 0, #t + 1 while 1 < right - left do local mid = math.floor((left + right) / 2) if query(i, t[mid]) then right = mid else left = mid end end table.insert(t, right, i) end end -- print("GC", gc) io.write("!\n") io.write(n - 1 .. "\n") io.write(table.concat(t, " ") .. "\n") io.flush()