結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 100 ms
86,864 KB
testcase_02 WA -
testcase_03 AC 101 ms
87,060 KB
testcase_04 WA -
testcase_05 AC 102 ms
86,980 KB
testcase_06 AC 144 ms
93,284 KB
testcase_07 WA -
testcase_08 AC 163 ms
92,168 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