結果

問題 No.2085 Directed Complete Graph
ユーザー だれだれ
提出日時 2022-09-23 21:36:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 24,480 KB
平均クエリ数 2472.00
最終ジャッジ日時 2023-08-24 03:07:44
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
24,036 KB
testcase_01 AC 39 ms
23,832 KB
testcase_02 AC 212 ms
24,016 KB
testcase_03 AC 198 ms
23,376 KB
testcase_04 AC 213 ms
23,616 KB
testcase_05 AC 113 ms
24,240 KB
testcase_06 AC 119 ms
23,392 KB
testcase_07 AC 196 ms
24,292 KB
testcase_08 AC 163 ms
23,532 KB
testcase_09 AC 194 ms
24,048 KB
testcase_10 AC 206 ms
23,376 KB
testcase_11 AC 202 ms
23,476 KB
testcase_12 AC 207 ms
24,028 KB
testcase_13 AC 205 ms
24,480 KB
testcase_14 AC 206 ms
23,616 KB
testcase_15 AC 39 ms
24,348 KB
testcase_16 AC 38 ms
23,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = i + 1

def merge_sort(v):
    if len(v) == 1:
        return v
    c = merge_sort(v[:len(v) // 2])
    d = merge_sort(v[len(v) // 2:])
    i, j = 0, 0
    res = []
    while i < len(c) and j < len(d):
        print("?", c[i], d[j])
        t = int(input())
        if t == 1:
            res.append(c[i])
            i += 1
        else:
            res.append(d[j])
            j += 1
    while i < len(c):
        res.append(c[i])
        i += 1
    while j < len(d):
        res.append(d[j])
        j += 1
    return res

a = merge_sort(a)
print("!")
print(n - 1)
print(*a)
0