結果

問題 No.1786 Maximum Suffix Median (Online)
ユーザー chineristACchineristAC
提出日時 2021-11-14 21:16:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 428 ms / 2,000 ms
コード長 754 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 105,232 KB
最終ジャッジ日時 2023-10-01 02:14:24
合計ジャッジ時間 16,712 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
74,224 KB
testcase_01 AC 110 ms
74,492 KB
testcase_02 AC 111 ms
74,156 KB
testcase_03 AC 112 ms
73,952 KB
testcase_04 AC 116 ms
74,160 KB
testcase_05 AC 113 ms
74,444 KB
testcase_06 AC 110 ms
74,672 KB
testcase_07 AC 111 ms
74,616 KB
testcase_08 AC 409 ms
101,672 KB
testcase_09 AC 337 ms
94,736 KB
testcase_10 AC 353 ms
97,340 KB
testcase_11 AC 327 ms
94,008 KB
testcase_12 AC 404 ms
104,416 KB
testcase_13 AC 343 ms
102,016 KB
testcase_14 AC 294 ms
97,028 KB
testcase_15 AC 318 ms
98,460 KB
testcase_16 AC 323 ms
98,580 KB
testcase_17 AC 296 ms
96,060 KB
testcase_18 AC 428 ms
104,828 KB
testcase_19 AC 419 ms
105,200 KB
testcase_20 AC 421 ms
105,088 KB
testcase_21 AC 417 ms
105,232 KB
testcase_22 AC 418 ms
103,960 KB
testcase_23 AC 309 ms
98,908 KB
testcase_24 AC 267 ms
93,788 KB
testcase_25 AC 339 ms
102,664 KB
testcase_26 AC 265 ms
94,900 KB
testcase_27 AC 255 ms
94,640 KB
testcase_28 AC 272 ms
96,832 KB
testcase_29 AC 113 ms
74,184 KB
testcase_30 AC 113 ms
74,164 KB
testcase_31 AC 326 ms
99,688 KB
testcase_32 AC 346 ms
104,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

def maximum_suffix_median_online(N,A):
    if N==1:
        return [A[0]]
    A[1] ^= A[0]
    res = [A[i] for i in range(N)]
    que = [[] for p in range(2)]
    
    for i in range(2,N):
        A[i] ^= res[i-1]
        p = i&1
        heappush(que[p],-A[i-1])
        heappush(que[p],-A[i-2])
        heappop(que[p])
        res[i] = max(A[i],-que[p][0])
    
    return res

N = int(input())
A = [int(input()) for i in range(N)]
print(*maximum_suffix_median_online(N,A),sep="\n")
0