//package slidwind;
import java.io.*;
import java.util.*;
class hac {
public static void main(String[] args) throws IOException {
hac obj = new hac();
obj.doStuff();
}
int[] nums;
int[] sums;
private void doStuff() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
nums = new int[Integer.parseInt(br.readLine())];
sums = new int[nums.length];
StringTokenizer st = new StringTokenizer(br.readLine());
for (int i = 0; i < nums.length; i++) {
nums[i] = Integer.parseInt(st.nextToken());
}
br.close();
int cap = nums.length/2;
if (nums.length%2==1) cap++;
int rsum = 0;
for (int i = 0; i < cap; i++) {
rsum += nums[i];
}
for (int i = 0; i < nums.length; i++) {
sums[i] = rsum;
rsum -= nums[i];
rsum += nums[(i+cap)%nums.length];
}
int max = 0;
for (int i = 0; i < nums.length; i++) {
int temp1 = sums[i];
int temp2 = sums[(i-cap+nums.length+1)%nums.length];
int temp = Math.min(temp1, temp2);
max = Math.max(max, temp);
}
System.out.println(max);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
8664 KB |
Output is correct |
2 |
Incorrect |
78 ms |
8460 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
8664 KB |
Output is correct |
2 |
Incorrect |
78 ms |
8460 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
77 ms |
8576 KB |
Output is correct |
2 |
Incorrect |
80 ms |
8404 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
8664 KB |
Output is correct |
2 |
Incorrect |
78 ms |
8460 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |