This documentation is automatically generated by online-judge-tools/verification-helper
View the Project on GitHub Rin204/Library-Python
# verification-helper: PROBLEM https://judge.yosupo.jp/problem/cartesian_tree from pathlib import Path import sys sys.path.append(str(Path(__file__).resolve().parent.parent.parent.parent)) def CartesianTree(A): n = len(A) P = [-1] * n B = [-1] * n p = -1 for i, a in enumerate(A): while p >= 0 and a < A[B[p]]: j = B[p] p -= 1 if p >= 0 and a < A[B[p]]: P[j] = B[p] else: P[j] = i p += 1 B[p] = i for i in range(p, 0, -1): P[B[i]] = B[i - 1] i = B[0] P[i] = i return P n = int(input()) A = list(map(int, input().split())) print(*CartesianTree(A))
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