結果

問題 No.3590 I Love Inversions
コンテスト
ユーザー flippergo
提出日時 2026-11-17 08:56:02
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 724 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 92 ms
コンパイル使用メモリ 64,512 KB
実行使用メモリ 71,548 KB
平均クエリ数 12103.46
最終ジャッジ日時 2026-11-17 08:56:38
合計ジャッジ時間 35,363 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 40 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
S = []
for i in range(2,N+1):
    print(f"? {1} {i}")
    S.append(int(input()))
X = [0,S[0]]
for i in range(1,N-1):
    X.append(S[i]-S[i-1])
K = 0
while 1<<K < N:
    K += 1
M = 1<<K
T = [0]*(M+1)
def bit_sum(i,x):
    j = i
    while j<=M:
        T[j] += x
        j += j&(-j)
def bit_cum(i):
    cnt = 0
    j = i
    while j>0:
        cnt += T[j]
        j -= j&(-j)
    return cnt
for i in range(1,N+1):
    bit_sum(i,1)
P = []
while X:
    x = X.pop()
    tot = T[N]-x
    high = N
    low = 0
    while high-low>1:
        mid = (high+low)//2
        if bit_cum(mid)>=tot:
            high = mid
        else:
            low = mid
    P.append(high)
    bit_sum(high,-1)
P = P[::-1]
print("!",*P)
0