結果
| 問題 | 
                            No.2577 Simple Permutation Guess
                             | 
                    
| コンテスト | |
| ユーザー | 
                             rlangevin
                         | 
                    
| 提出日時 | 2023-12-05 00:19:41 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 692 bytes | 
| コンパイル時間 | 169 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 95,304 KB | 
| 平均クエリ数 | 279.53 | 
| 最終ジャッジ日時 | 2024-09-26 23:31:06 | 
| 合計ジャッジ時間 | 20,983 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 71 RE * 40 | 
ソースコード
N = int(input())
L = list(range(1, N + 1))
ans = []
def check(ans, mid, L):
    temp = L[mid]
    L1 = L[:mid]
    L2 = L[mid+1:]
    lst = ["?"] + ans + [temp] + L1 + L2
    print(*lst, flush=True)
    flag = int(input())
    return flag
for i in range(N - 1):
    yes = 0
    temp = L.pop()
    lst = ["?"] + ans + [temp] + L
    print(*lst, flush=True)
    flag = int(input())
    if flag:
        ans.append(temp)
        continue
    L.append(temp)
    no = len(L) - 1
    while no - yes != 1:
        mid = (yes + no)//2
        if check(ans, mid, L):
            yes = mid
        else:
            no = mid
    v = L.pop(yes)
    ans.append(v)
    
ans = ["!"] + ans + L
print(*ans)
            
            
            
        
            
rlangevin