Library-Python

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub Rin204/Library-Python

src/$tests/misc/MedianHeap.test.py

Depends on

Code

# verification-helper: PROBLEM https://judge.yosupo.jp/problem/aplusb
from pathlib import Path
import sys

sys.path.append(str(Path(__file__).resolve().parent.parent.parent.parent))

from src.misc.MadianHeap import MedianHeap
import random


A = [random.randrange(10**9) for _ in range(2000)]
hq = MedianHeap(A)
Q = 1000
for _ in range(Q):
    t = random.randrange(2)
    if t == 0:
        a = random.randrange(10**9)
        hq.push(a)
        A.append(a)
    else:
        a = random.choice(A)
        hq.remove(a)
        A.remove(a)

    A.sort()
    n = len(A)
    if n % 2 == 1:
        assert hq.get_med() == [A[n // 2], A[n // 2]]
    else:
        assert hq.get_med() == [A[n // 2 - 1], A[n // 2]]

    m = A[n // 2]
    assert hq.abs_sum() == sum(abs(a - m) for a in A)


a, b = map(int, input().split())
print(a + b)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/documentation/build.py", line 81, in _render_source_code_stat
    bundled_code = language.bundle(
                   ^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/onlinejudge_verify/languages/python.py", line 108, in bundle
    raise NotImplementedError
NotImplementedError
Back to top page