結果

問題 No.2124 Guess the Permutation
コンテスト
ユーザー NP
提出日時 2024-03-17 12:23:40
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 446 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 306 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 97,952 KB
平均クエリ数 374.60
最終ジャッジ日時 2026-04-16 10:04:09
合計ジャッジ時間 2,722 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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