답안 #1050334

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1050334 2024-08-09T08:48:02 Z vjudge1 Art Exhibition (JOI18_art) Python 3
10 / 100
1000 ms 3000 KB
from itertools import combinations

def maximize_exhibition_value(N, artworks):
    max_value = float('-inf')

    # Try every possible non-empty subset
    for r in range(1, N+1):
        for subset in combinations(artworks, r):
            sizes = [art[0] for art in subset]
            values = [art[1] for art in subset]

            A_max = max(sizes)
            A_min = min(sizes)
            S = sum(values)

            current_value = S - (A_max - A_min)
            max_value = max(max_value, current_value)

    return max_value

# Input reading
N = int(input().strip())
artworks = []
for _ in range(N):
    A, B = map(int, input().strip().split())
    artworks.append((A, B))

# Calculate and print the result
result = maximize_exhibition_value(N, artworks)
print(result)
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 2908 KB Output is correct
2 Correct 86 ms 2908 KB Output is correct
3 Correct 89 ms 2908 KB Output is correct
4 Correct 90 ms 2992 KB Output is correct
5 Correct 91 ms 2908 KB Output is correct
6 Correct 92 ms 2996 KB Output is correct
7 Correct 88 ms 2908 KB Output is correct
8 Correct 90 ms 3000 KB Output is correct
9 Correct 90 ms 2908 KB Output is correct
10 Correct 92 ms 2908 KB Output is correct
11 Correct 90 ms 2908 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 2908 KB Output is correct
2 Correct 86 ms 2908 KB Output is correct
3 Correct 89 ms 2908 KB Output is correct
4 Correct 90 ms 2992 KB Output is correct
5 Correct 91 ms 2908 KB Output is correct
6 Correct 92 ms 2996 KB Output is correct
7 Correct 88 ms 2908 KB Output is correct
8 Correct 90 ms 3000 KB Output is correct
9 Correct 90 ms 2908 KB Output is correct
10 Correct 92 ms 2908 KB Output is correct
11 Correct 90 ms 2908 KB Output is correct
12 Execution timed out 1032 ms 2908 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 2908 KB Output is correct
2 Correct 86 ms 2908 KB Output is correct
3 Correct 89 ms 2908 KB Output is correct
4 Correct 90 ms 2992 KB Output is correct
5 Correct 91 ms 2908 KB Output is correct
6 Correct 92 ms 2996 KB Output is correct
7 Correct 88 ms 2908 KB Output is correct
8 Correct 90 ms 3000 KB Output is correct
9 Correct 90 ms 2908 KB Output is correct
10 Correct 92 ms 2908 KB Output is correct
11 Correct 90 ms 2908 KB Output is correct
12 Execution timed out 1032 ms 2908 KB Time limit exceeded
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 2908 KB Output is correct
2 Correct 86 ms 2908 KB Output is correct
3 Correct 89 ms 2908 KB Output is correct
4 Correct 90 ms 2992 KB Output is correct
5 Correct 91 ms 2908 KB Output is correct
6 Correct 92 ms 2996 KB Output is correct
7 Correct 88 ms 2908 KB Output is correct
8 Correct 90 ms 3000 KB Output is correct
9 Correct 90 ms 2908 KB Output is correct
10 Correct 92 ms 2908 KB Output is correct
11 Correct 90 ms 2908 KB Output is correct
12 Execution timed out 1032 ms 2908 KB Time limit exceeded
13 Halted 0 ms 0 KB -