結果
| 問題 |
No.2124 Guess the Permutation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-11 13:10:14 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 196 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 92,760 KB |
| 平均クエリ数 | 374.60 |
| 最終ジャッジ日時 | 2024-11-27 11:48:15 |
| 合計ジャッジ時間 | 1,949 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 WA * 1 |
ソースコード
def main():
N = int(input())
P = [0] * N
for i in range(N-1):
print('?', i+1, i+2)
S = int(input())
P[i+1] = S
for i in range(1, N+1):
ans = [0] * N
ans[0] = i
juge = True
for j in range(1, N):
p = P[j] - ans[j-1]
ans[j] = p
if p <= 0 or p > N:
juge = False
break
if len(set(ans)) == N and juge:
print('!', *ans)
exit()
if __name__ == '__main__':
main()