結果

問題 No.850 企業コンテスト2位
ユーザー vwxyzvwxyz
提出日時 2023-12-26 08:08:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 659 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 26,112 KB
平均クエリ数 200.07
最終ジャッジ日時 2023-12-26 08:08:15
合計ジャッジ時間 4,027 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
26,112 KB
testcase_01 AC 55 ms
26,112 KB
testcase_02 AC 56 ms
26,112 KB
testcase_03 AC 55 ms
26,112 KB
testcase_04 AC 54 ms
26,112 KB
testcase_05 AC 54 ms
26,112 KB
testcase_06 AC 54 ms
26,112 KB
testcase_07 AC 59 ms
26,112 KB
testcase_08 AC 62 ms
26,112 KB
testcase_09 AC 61 ms
26,112 KB
testcase_10 AC 69 ms
26,112 KB
testcase_11 AC 67 ms
26,112 KB
testcase_12 AC 66 ms
26,112 KB
testcase_13 AC 66 ms
26,112 KB
testcase_14 AC 65 ms
26,112 KB
testcase_15 AC 67 ms
26,112 KB
testcase_16 AC 68 ms
26,112 KB
testcase_17 AC 68 ms
26,112 KB
testcase_18 AC 67 ms
26,112 KB
testcase_19 AC 68 ms
26,112 KB
testcase_20 AC 68 ms
26,112 KB
testcase_21 AC 68 ms
26,112 KB
testcase_22 AC 68 ms
26,112 KB
testcase_23 AC 69 ms
26,112 KB
testcase_24 AC 69 ms
26,112 KB
testcase_25 AC 68 ms
26,112 KB
testcase_26 AC 66 ms
26,112 KB
testcase_27 AC 54 ms
26,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
player=[x for x in range(N)]
opponent=[[] for x in range(N)]
while len(player)>=2:
    prev=player
    player=[]
    while len(prev)>=2:
        x,y=prev.pop(),prev.pop()
        print("?",x+1,y+1)
        ans=int(input())-1
        player.append(ans)
        opponent[ans].append(x^y^ans)
    if prev:
        player.append(prev.pop())
first=player[0]
player=opponent[first]
while len(player)>=2:
    prev=player
    player=[]
    while len(prev)>=2:
        x,y=prev.pop(),prev.pop()
        print("?",x+1,y+1)
        ans=int(input())-1
        player.append(ans)
    if prev:
        player.append(prev.pop())
ans=player[0]
print("!",ans+1)
0