結果

問題 No.2124 Guess the Permutation
ユーザー 👑 tamatotamato
提出日時 2022-11-18 21:29:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 81,640 KB
実行使用メモリ 82,652 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-10-20 06:16:36
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
69,884 KB
testcase_01 AC 62 ms
69,884 KB
testcase_02 AC 62 ms
69,884 KB
testcase_03 AC 63 ms
69,884 KB
testcase_04 AC 66 ms
69,884 KB
testcase_05 AC 68 ms
69,884 KB
testcase_06 AC 100 ms
80,604 KB
testcase_07 AC 123 ms
82,652 KB
testcase_08 AC 122 ms
82,652 KB
testcase_09 AC 124 ms
82,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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