結果

問題 No.2124 Guess the Permutation
ユーザー kept1994kept1994
提出日時 2022-11-19 01:28:22
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 584 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 89,584 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 10:02:18
合計ジャッジ時間 3,406 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
80,060 KB
testcase_01 AC 81 ms
80,060 KB
testcase_02 AC 81 ms
80,060 KB
testcase_03 AC 82 ms
80,060 KB
testcase_04 AC 85 ms
80,060 KB
testcase_05 AC 88 ms
82,108 KB
testcase_06 AC 117 ms
84,336 KB
testcase_07 AC 148 ms
89,580 KB
testcase_08 AC 146 ms
89,584 KB
testcase_09 AC 146 ms
89,584 KB
権限があれば一括ダウンロードができます

ソースコード

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