結果
| 問題 |
No.2085 Directed Complete Graph
|
| ユーザー |
convexineq
|
| 提出日時 | 2024-06-03 07:32:57 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 269 ms / 2,000 ms |
| コード長 | 965 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,028 KB |
| 実行使用メモリ | 93,476 KB |
| 平均クエリ数 | 2451.65 |
| 最終ジャッジ日時 | 2024-12-23 10:33:30 |
| 合計ジャッジ時間 | 5,099 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 15 |
ソースコード
def merge_sort(A,cmp):
def merge(L,M,R):
B = A[L:R]
j1 = 0
j2 = l1 = M-L
l2 = R-L
while j1 < l1 or j2 < l2:
if j2 == l2 or (j1 < l1 and cmp(B[j1],B[j2]) <= 0):
A[L] = B[j1]
j1 += 1
else:
A[L] = B[j2]
j2 += 1
L += 1
n = len(A)
step = 1
while step < n:
L = 0
M = step
R = step = step*2
while M < n:
if R >= n:
R = n
merge(L,M,R)
L = R
M += step
R += step
def cmp(s,t):
return -1 if query(s,t) == 1 else 1
def query(x,y):
print(f"? {x} {y}", flush=1)
if DEBUG:
return 1
else:
return int(input())
import sys
readline = sys.stdin.readline
DEBUG = 0
n = int(readline())
a = list(range(1,n+1))
merge_sort(a,cmp)
print("!",flush=1)
print(n-1,flush=1)
print(*a,flush=1)
convexineq