답안 #1050312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050312 2024-08-09T08:40:33 Z vjudge1 Art Exhibition (JOI18_art) Python 3
컴파일 오류
0 ms 0 KB
def max_artwork_value_two_pointers(N, artworks):
    artworks.sort()

    left = 0
    current_value = 0
    max_result = float('-inf')

    for right in range(N):
        current_value += artworks[right][1] я

        while artworks[right][0] - artworks[left][0] > 0:
            max_result = max(max_result, current_value - (artworks[right][0] - artworks[left][0]))
            current_value -= artworks[left][1]
            left += 1

        max_result = max(max_result, current_value - (artworks[right][0] - artworks[left][0]))

    return max_result

N = int(input().strip())
artworks = []
for _ in range(N):
    Ai, Bi = map(int, input().split())
    artworks.append((Ai, Bi))

print(max_artwork_value_two_pointers(N, artworks))

Compilation message

File "art.py", line 9
    current_value += artworks[right][1] я
                                        ^
SyntaxError: invalid syntax