結果

問題 No.2124 Guess the Permutation
ユーザー McGregorshMcGregorsh
提出日時 2023-05-11 13:10:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 1,250 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 93,328 KB
平均クエリ数 374.60
最終ジャッジ日時 2023-08-18 08:03:10
合計ジャッジ時間 3,886 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
87,572 KB
testcase_01 AC 99 ms
87,444 KB
testcase_02 AC 96 ms
87,344 KB
testcase_03 AC 96 ms
87,068 KB
testcase_04 AC 97 ms
87,376 KB
testcase_05 AC 105 ms
87,216 KB
testcase_06 AC 153 ms
92,564 KB
testcase_07 AC 180 ms
93,224 KB
testcase_08 AC 164 ms
92,344 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 or p > N:
   	  	  	  juge = False
   	  	  	  break
   	  if len(set(ans)) == N and juge:
   	  	  print('!', *ans)
   	  	  exit()
   	  
   
   
   
if __name__ == '__main__':
    main()
    
0