제출 #371367

#제출 시각아이디문제언어결과실행 시간메모리
371367dapigHacker (BOI15_hac)Java
0 / 100
80 ms8664 KiB

//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);

	}

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...