結果

問題 No.2124 Guess the Permutation
ユーザー McGregorshMcGregorsh
提出日時 2023-05-11 13:07:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 92,376 KB
平均クエリ数 374.60
最終ジャッジ日時 2024-05-05 13:52:49
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 55 ms
68,176 KB
testcase_02 WA -
testcase_03 AC 54 ms
68,056 KB
testcase_04 WA -
testcase_05 AC 62 ms
69,336 KB
testcase_06 AC 123 ms
92,376 KB
testcase_07 WA -
testcase_08 AC 145 ms
85,848 KB
testcase_09 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
    
0