結果
問題 | No.2124 Guess the Permutation |
ユーザー |
|
提出日時 | 2023-05-11 13:07:11 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 481 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 92,376 KB |
平均クエリ数 | 374.60 |
最終ジャッジ日時 | 2024-11-27 11:45:49 |
合計ジャッジ時間 | 2,150 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 5 WA * 4 |
ソースコード
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 and p > N: juge = False break if len(set(ans)) == N and juge: print('!', *ans) exit() if __name__ == '__main__': main()