結果

問題 No.2124 Guess the Permutation
ユーザー kept1994kept1994
提出日時 2022-11-19 01:28:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 82,068 KB
実行使用メモリ 91,096 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-09-20 05:31:17
合計ジャッジ時間 2,343 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import string

def main():
    ans = []
    N = int(input())
    tot = (1 + N) * N // 2
    print(f"? 2 {N}", flush=True)
    res = int(input())
    ans.append(str(tot - res))
    acc = tot - res
    for i in range(1, N - 1):
        print(f"? {i} {i + 1}", flush=True)
        res = int(input())
        r = res - int(ans[-1])
        ans.append(str(r))
        acc += r
    ans.append(str(tot - acc))
    l = " ".join(ans)
    print(f"! {l}")
    return

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