結果

問題 No.2124 Guess the Permutation
ユーザー Ekiben542Ekiben542
提出日時 2024-03-17 12:23:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 446 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 93,168 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-03-17 12:23:43
合計ジャッジ時間 3,308 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def ask(l, r):
    print('?', l, r, flush=True)
    return int(input())

def solve(N):
    answers = [0] * N
    total_sum = ask(1, N)
    for i in range(1, N):
        two_sum = ask(i, i + 1)
        answers[i - 1] = total_sum - two_sum
        total_sum = two_sum
    answers[-1] = total_sum
    return answers

def main():
    N = int(input())
    answers = solve(N)
    print('!', *answers)

if __name__ == "__main__":
    main()
0