結果

問題 No.2124 Guess the Permutation
コンテスト
ユーザー tamato
提出日時 2022-11-18 21:29:19
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 535 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 167 ms
コンパイル使用メモリ 85,012 KB
実行使用メモリ 86,964 KB
平均クエリ数 374.60
最終ジャッジ日時 2026-04-08 14:26:16
合計ジャッジ時間 2,118 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())

    x = N * (N + 1) // 2
    P = []
    for r in range(N - 1, 1, -1):
        print("?", 1, r)
        sys.stdout.flush()
        y = int(input())
        P.append(x - y)
        x = y
    print("?", 2, 3)
    sys.stdout.flush()
    y = int(input())
    P.append(y - P[-1])
    P.append((N + 1) * N // 2 - sum(P))
    P.append("!")
    P.reverse()
    print(*P)
    sys.stdout.flush()
    exit()


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