結果

問題 No.2085 Directed Complete Graph
ユーザー 👑 rin204rin204
提出日時 2023-01-23 17:04:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 327 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 86,816 KB
実行使用メモリ 94,388 KB
平均クエリ数 2472.00
最終ジャッジ日時 2023-09-07 18:55:25
合計ジャッジ時間 6,371 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
87,260 KB
testcase_01 AC 95 ms
87,004 KB
testcase_02 AC 316 ms
93,960 KB
testcase_03 AC 301 ms
93,960 KB
testcase_04 AC 327 ms
93,996 KB
testcase_05 AC 222 ms
93,976 KB
testcase_06 AC 232 ms
93,532 KB
testcase_07 AC 310 ms
93,604 KB
testcase_08 AC 267 ms
93,888 KB
testcase_09 AC 305 ms
93,572 KB
testcase_10 AC 316 ms
93,784 KB
testcase_11 AC 327 ms
94,388 KB
testcase_12 AC 317 ms
93,472 KB
testcase_13 AC 323 ms
94,092 KB
testcase_14 AC 313 ms
93,460 KB
testcase_15 AC 94 ms
87,172 KB
testcase_16 AC 95 ms
86,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(range(1, n + 1))

def dc(A):
    if len(A) <= 1:
        return A

    n = len(A)
    L = dc(A[:n // 2])
    R = dc(A[n // 2:])
    lp = 0
    rp = 0
    ret = []
    while lp < len(L) and rp < len(R):
        print("?", L[lp], R[rp], flush=True)
        t = int(input())
        if t:
            ret.append(L[lp])
            lp += 1
        else:
            ret.append(R[rp])
            rp += 1
    ret += L[lp:] + R[rp:]
    return ret

A = dc(A)
print("!")
print(n - 1)
print(*A)
0