from itertools import combinations as c
N=int(input())
a=[list(map(int,input().split()))for _ in range(N)]
print(max(sum(x[1] for x in s)-(max(x[0] for x in s)-min(x[0] for x in s)) for r in range(1,N+1) for s in c(a,r)))
# Brute force T-T
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
2896 KB |
Output is correct |
2 |
Correct |
171 ms |
2968 KB |
Output is correct |
3 |
Correct |
136 ms |
2964 KB |
Output is correct |
4 |
Correct |
138 ms |
2964 KB |
Output is correct |
5 |
Correct |
135 ms |
2968 KB |
Output is correct |
6 |
Correct |
148 ms |
2912 KB |
Output is correct |
7 |
Correct |
147 ms |
2972 KB |
Output is correct |
8 |
Correct |
181 ms |
2980 KB |
Output is correct |
9 |
Correct |
133 ms |
2896 KB |
Output is correct |
10 |
Correct |
144 ms |
2960 KB |
Output is correct |
11 |
Correct |
137 ms |
2916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
2896 KB |
Output is correct |
2 |
Correct |
171 ms |
2968 KB |
Output is correct |
3 |
Correct |
136 ms |
2964 KB |
Output is correct |
4 |
Correct |
138 ms |
2964 KB |
Output is correct |
5 |
Correct |
135 ms |
2968 KB |
Output is correct |
6 |
Correct |
148 ms |
2912 KB |
Output is correct |
7 |
Correct |
147 ms |
2972 KB |
Output is correct |
8 |
Correct |
181 ms |
2980 KB |
Output is correct |
9 |
Correct |
133 ms |
2896 KB |
Output is correct |
10 |
Correct |
144 ms |
2960 KB |
Output is correct |
11 |
Correct |
137 ms |
2916 KB |
Output is correct |
12 |
Execution timed out |
1067 ms |
2896 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
2896 KB |
Output is correct |
2 |
Correct |
171 ms |
2968 KB |
Output is correct |
3 |
Correct |
136 ms |
2964 KB |
Output is correct |
4 |
Correct |
138 ms |
2964 KB |
Output is correct |
5 |
Correct |
135 ms |
2968 KB |
Output is correct |
6 |
Correct |
148 ms |
2912 KB |
Output is correct |
7 |
Correct |
147 ms |
2972 KB |
Output is correct |
8 |
Correct |
181 ms |
2980 KB |
Output is correct |
9 |
Correct |
133 ms |
2896 KB |
Output is correct |
10 |
Correct |
144 ms |
2960 KB |
Output is correct |
11 |
Correct |
137 ms |
2916 KB |
Output is correct |
12 |
Execution timed out |
1067 ms |
2896 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
145 ms |
2896 KB |
Output is correct |
2 |
Correct |
171 ms |
2968 KB |
Output is correct |
3 |
Correct |
136 ms |
2964 KB |
Output is correct |
4 |
Correct |
138 ms |
2964 KB |
Output is correct |
5 |
Correct |
135 ms |
2968 KB |
Output is correct |
6 |
Correct |
148 ms |
2912 KB |
Output is correct |
7 |
Correct |
147 ms |
2972 KB |
Output is correct |
8 |
Correct |
181 ms |
2980 KB |
Output is correct |
9 |
Correct |
133 ms |
2896 KB |
Output is correct |
10 |
Correct |
144 ms |
2960 KB |
Output is correct |
11 |
Correct |
137 ms |
2916 KB |
Output is correct |
12 |
Execution timed out |
1067 ms |
2896 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |