結果

問題 No.2124 Guess the Permutation
ユーザー titiatitia
提出日時 2022-11-18 21:30:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 320 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 26,544 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:17:23
合計ジャッジ時間 1,769 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
26,424 KB
testcase_01 AC 49 ms
26,424 KB
testcase_02 AC 50 ms
26,424 KB
testcase_03 AC 51 ms
26,424 KB
testcase_04 AC 56 ms
26,424 KB
testcase_05 AC 55 ms
26,428 KB
testcase_06 AC 75 ms
26,476 KB
testcase_07 AC 90 ms
26,544 KB
testcase_08 AC 90 ms
26,544 KB
testcase_09 AC 91 ms
26,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())


SUM=(N+1)*N//2

ANS=[0]*N

NOW=SUM
for i in range(N-2):
    print("?",i+2,N,flush=True)
    x=int(input())

    ANS[i]=NOW-x
    NOW-=ANS[i]
    
    
print("?",N-2,N-1,flush=True)
x=int(input())

ANS[-2]=x-ANS[-3]
ANS[-1]=SUM-sum(ANS)

print("!",*ANS,flush=True)
0