Submission #1050357

# Submission time Handle Problem Language Result Execution time Memory
1050357 2024-08-09T08:55:12 Z vjudge1 Art Exhibition (JOI18_art) Python 3
30 / 100
1000 ms 3668 KB
def maximize_exhibition_value(N, artworks):
    # Sort artworks by their size A
    artworks.sort()
    
    max_value = float('-inf')
    
    for i in range(N):
        current_sum = 0
        A_min = artworks[i][0]
        
        for j in range(i, N):
            current_sum += artworks[j][1]
            A_max = artworks[j][0]
            current_value = current_sum - (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)
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2844 KB Output is correct
2 Correct 10 ms 2908 KB Output is correct
3 Correct 11 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 9 ms 2908 KB Output is correct
6 Correct 9 ms 2908 KB Output is correct
7 Correct 11 ms 2904 KB Output is correct
8 Correct 9 ms 2908 KB Output is correct
9 Correct 9 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 9 ms 2928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2844 KB Output is correct
2 Correct 10 ms 2908 KB Output is correct
3 Correct 11 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 9 ms 2908 KB Output is correct
6 Correct 9 ms 2908 KB Output is correct
7 Correct 11 ms 2904 KB Output is correct
8 Correct 9 ms 2908 KB Output is correct
9 Correct 9 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 9 ms 2928 KB Output is correct
12 Correct 27 ms 2904 KB Output is correct
13 Correct 18 ms 2908 KB Output is correct
14 Correct 19 ms 3024 KB Output is correct
15 Correct 28 ms 2968 KB Output is correct
16 Correct 19 ms 2908 KB Output is correct
17 Correct 29 ms 2908 KB Output is correct
18 Correct 19 ms 2908 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 18 ms 2908 KB Output is correct
21 Correct 24 ms 3032 KB Output is correct
22 Correct 18 ms 3028 KB Output is correct
23 Correct 25 ms 2908 KB Output is correct
24 Correct 20 ms 2980 KB Output is correct
25 Correct 18 ms 2908 KB Output is correct
26 Correct 28 ms 3040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2844 KB Output is correct
2 Correct 10 ms 2908 KB Output is correct
3 Correct 11 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 9 ms 2908 KB Output is correct
6 Correct 9 ms 2908 KB Output is correct
7 Correct 11 ms 2904 KB Output is correct
8 Correct 9 ms 2908 KB Output is correct
9 Correct 9 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 9 ms 2928 KB Output is correct
12 Correct 27 ms 2904 KB Output is correct
13 Correct 18 ms 2908 KB Output is correct
14 Correct 19 ms 3024 KB Output is correct
15 Correct 28 ms 2968 KB Output is correct
16 Correct 19 ms 2908 KB Output is correct
17 Correct 29 ms 2908 KB Output is correct
18 Correct 19 ms 2908 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 18 ms 2908 KB Output is correct
21 Correct 24 ms 3032 KB Output is correct
22 Correct 18 ms 3028 KB Output is correct
23 Correct 25 ms 2908 KB Output is correct
24 Correct 20 ms 2980 KB Output is correct
25 Correct 18 ms 2908 KB Output is correct
26 Correct 28 ms 3040 KB Output is correct
27 Execution timed out 1020 ms 3668 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 2844 KB Output is correct
2 Correct 10 ms 2908 KB Output is correct
3 Correct 11 ms 2908 KB Output is correct
4 Correct 9 ms 2908 KB Output is correct
5 Correct 9 ms 2908 KB Output is correct
6 Correct 9 ms 2908 KB Output is correct
7 Correct 11 ms 2904 KB Output is correct
8 Correct 9 ms 2908 KB Output is correct
9 Correct 9 ms 2908 KB Output is correct
10 Correct 9 ms 2908 KB Output is correct
11 Correct 9 ms 2928 KB Output is correct
12 Correct 27 ms 2904 KB Output is correct
13 Correct 18 ms 2908 KB Output is correct
14 Correct 19 ms 3024 KB Output is correct
15 Correct 28 ms 2968 KB Output is correct
16 Correct 19 ms 2908 KB Output is correct
17 Correct 29 ms 2908 KB Output is correct
18 Correct 19 ms 2908 KB Output is correct
19 Correct 19 ms 3028 KB Output is correct
20 Correct 18 ms 2908 KB Output is correct
21 Correct 24 ms 3032 KB Output is correct
22 Correct 18 ms 3028 KB Output is correct
23 Correct 25 ms 2908 KB Output is correct
24 Correct 20 ms 2980 KB Output is correct
25 Correct 18 ms 2908 KB Output is correct
26 Correct 28 ms 3040 KB Output is correct
27 Execution timed out 1020 ms 3668 KB Time limit exceeded
28 Halted 0 ms 0 KB -