結果

問題 No.2124 Guess the Permutation
コンテスト
ユーザー terasa
提出日時 2022-11-18 23:31:43
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 796 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 178 ms
コンパイル使用メモリ 82,440 KB
実行使用メモリ 88,732 KB
平均クエリ数 1.00
最終ジャッジ日時 2024-09-20 03:57:41
合計ジャッジ時間 2,053 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 1
other RE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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