結果

問題 No.2124 Guess the Permutation
ユーザー terasaterasa
提出日時 2022-11-18 23:31:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 796 bytes
コンパイル時間 250 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 87,028 KB
平均クエリ数 1.00
最終ジャッジ日時 2023-10-20 08:29:23
合計ジャッジ時間 2,404 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from typing import List, Tuple, Optional
from collections import deque
import sys
import itertools
import heapq
import bisect
import math
from collections import deque, defaultdict
from functools import lru_cache, cmp_to_key

input = sys.stdin.readline

if __file__ != 'prog.py':
    sys.setrecursionlimit(10 ** 6)


def readints(): return map(int, input().split())
def readlist(): return list(readints())
def readstr(): return input()[:-1]


def query(l, r):
    print(f'? {l} {r}', flush=True)
    S = int(input())
    return S


N = int(input())
P = []
prev = 0
rest = {i for i in range(1, N + 1)}
for i in range(1, N):
    S = query(1, i)
    n = S - prev
    P.append(n)
    rest.discard(n)
    prev = S
P.append(rest.pop())
ans = f"! {' '.join([str(n) for n in P])}"
print(ans, flush=True)
0