結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-13 19:25:29 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 95 ms / 2,000 ms |
| コード長 | 583 bytes |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 27,736 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2024-09-15 15:12:37 |
| 合計ジャッジ時間 | 1,850 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 9 |
ソースコード
def main():
N = int(input())
P = []
result = []
for idx in range(2, N):
print(f"? {idx} {N}", flush=True)
response = int(input())
result.append(response)
if idx == 2:
P.append(N * (N + 1) // 2 - response)
elif idx >= 3:
P.append(result[-2] - result[-1])
print(f"? {1} {N-1}", flush=True)
response = int(input())
last = N * (N + 1) // 2 - response
P.append(result[-1] - last)
P.append(last)
print("! " + " ".join(map(str, P)), flush=True)
if __name__ == "__main__":
main()