結果

問題 No.2124 Guess the Permutation
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-16 19:40:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 756 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 93,228 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-08-21 08:23:17
合計ジャッジ時間 2,808 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
87,120 KB
testcase_01 AC 93 ms
86,872 KB
testcase_02 AC 93 ms
87,216 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 155 ms
91,960 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
ans = [0]*n
print(f'? {1} {2}',flush=True)
t = int(input())
print(f'? {2} {3}',flush=True)
t2 = int(input())
    
for i in range(1,n+1):
    f = 0
    for j in range(1,n+1):
        if i == j:
            continue
        x = (t + t2) - (i + j)
        if x > 0 and (x%2 == 0):
            y=x//2
            if len({i,j,y}) != 3 or y > n:
                continue
            if y+i == t and y + j == t2:
                ans[0] = i
                ans[2] = j
                ans[1] = y
                f = 1
                break
    if f == 1:
        break
                
ind = 4
while n >= ind:
    print(f'? {ind-1} {ind}',flush = True)
    t=int(input())
    ans[ind-1] = t - ans[ind-2]
    ind += 1
    

print('!',*ans,flush=True)
0