結果
| 問題 |
No.282 おもりと天秤(2)
|
| コンテスト | |
| ユーザー |
しらっ亭
|
| 提出日時 | 2015-09-24 01:05:41 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,035 bytes |
| コンパイル時間 | 201 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 29,896 KB |
| 平均クエリ数 | 219.83 |
| 最終ジャッジ日時 | 2024-07-16 06:23:04 |
| 合計ジャッジ時間 | 21,527 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 20 |
ソースコード
from functools import cmp_to_key
import sys
def solve():
N = int(input())
a = list(range(N))
m = [[0] * N for _ in range(N)]
def parse(ans, qs):
for a, q in zip(ans, qs):
l, r = q
if a == '<':
m[l][r] = -1
m[r][l] = 1
else:
m[l][r] = 1
m[r][l] = -1
for step in range(1, N):
used = [0] * N
qs = []
qa = ['?']
for i in range(N):
j = (i + step) % N
if used[i] == 0 and used[j] == 0:
qs.append((i, j))
qa.append(str(i + 1))
qa.append(str(j + 1))
used[i] = used[j] = 1
print(' '.join(qa) + ' 0' * (N * 2 - len(qs) * 2))
sys.stdout.flush()
ans = input().split()
parse(ans, qs)
@cmp_to_key
def cmp(l, r):
return m[l][r]
a.sort(key=cmp)
print('! ' + ' '.join(map(lambda i: str(i + 1), a)))
if __name__ == '__main__':
solve()
しらっ亭