結果

問題 No.282 おもりと天秤(2)
ユーザー kimiyuki
提出日時 2016-06-14 18:31:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 880 ms / 5,000 ms
コード長 534 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 27,720 KB
平均クエリ数 211.21
最終ジャッジ日時 2024-07-16 23:57:25
合計ジャッジ時間 9,983 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
QUERY_LIMIT = 2000
n = int(input())
a = list(range(1,n+1))
for i in range(QUERY_LIMIT):
    q = []
    j = i % 2
    while j+1 < n:
        q += [a[j], a[j+1]]
        j += 2
    while len(q)//2 < n:
        q += [0, 0]
    print('?', *q)
    sys.stdout.flush()
    q = input().split()
    j = i % 2
    modified = False
    while j+1 < n:
        if q[j//2] == '>':
            a[j], a[j+1] = a[j+1], a[j]
            modified = True
        j += 2
    if not modified:
        break
print('!', *a)
0