結果
| 問題 | No.2124 Guess the Permutation |
| コンテスト | |
| ユーザー |
koheijkt
|
| 提出日時 | 2026-04-09 18:55:43 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 428 bytes |
| 記録 | |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 85,452 KB |
| 実行使用メモリ | 91,588 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2026-04-09 18:55:46 |
| 合計ジャッジ時間 | 1,900 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
N = int(input())
ans = [0] * (N + 1)
total = N*(N + 1)//2
# 末尾のみ特定
print('?', 1, N - 1, flush=True)
res = int(input())
ans[N] = total - res
rui = 0
for i in range(2, N):
# ターンi は i-1 の答えが分かる
print('?', i, N, flush=True)
res = int(input())
ans[i - 1] = total - res - rui
rui += ans[i - 1]
# N - 1 を特定
ans[N - 1] = total - sum(ans)
print('!', *ans[1:], flush=True)
koheijkt