제출 #909377

#제출 시각아이디문제언어결과실행 시간메모리
909377shoryu386Hacker (BOI15_hac)C++17
40 / 100
1076 ms2396 KiB
#include <bits/stdc++.h>
using namespace std;
#define MAX 200007
#define int long long
main(){
	int n; cin >> n;
	
	int count = (n+1)/2;
	
	int arr[2*n];
	for (int x = 0; x < n; x++) cin >> arr[x];
	for (int x = 0; x < n; x++) arr[n + x] = arr[x];
	
	
	int hmm[n]; memset(hmm, 63, sizeof(hmm));
	
	for (int x = 0; x < n; x++){
		int sum = 0;
		for (int y = x; y < x+count; y++){
			sum += arr[y];
		}
		
		for (int y = x; y < x+count; y++){
			hmm[y % n] = min(hmm[y % n], sum);
		}
	}
	
	int ans = INT_MIN;
	for (int x = 0; x < n; x++){
		ans = max(ans, hmm[x]);
	}
	cout << ans;
}

컴파일 시 표준 에러 (stderr) 메시지

hac.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...