답안 #371367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
371367 2021-02-26T14:36:41 Z dapig Hacker (BOI15_hac) Java 11
0 / 100
80 ms 8664 KB
//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 -