結果
| 問題 |
No.2085 Directed Complete Graph
|
| ユーザー |
kemuniku
|
| 提出日時 | 2024-10-23 06:10:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 813 bytes |
| コンパイル時間 | 527 ms |
| コンパイル使用メモリ | 82,536 KB |
| 実行使用メモリ | 95,040 KB |
| 平均クエリ数 | 1567.59 |
| 最終ジャッジ日時 | 2024-10-23 06:10:39 |
| 合計ジャッジ時間 | 5,371 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 RE * 3 |
ソースコード
from random import shuffle
N = int(input())
P = list(range(1,N+1))
#shuffle(P)
paths = set()
def ask(a,b):
if (a,b) in paths:
return True
elif (b,a) in paths:
return False
print("?",P[a],P[b])
T = int(input())
if T == 1:
paths.add((a,b))
else:
paths.add((b,a))
return T == 1
if ask(0,1):
now = [0,1]
else:
now = [1,0]
for i in range(2,N):
if ask(i,now[0]):
now.insert(0,i)
elif ask(now[-1],i):
now.append(i)
else:
ok = 0
ng = len(now)-1
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if ask(now[mid],i):
ok = mid
else:
ng = mid
now.insert(ok+1,i)
print("!")
print(len(now)-1)
print(*list(map(lambda x:P[x],now)))
kemuniku