답안 #114039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
114039 2019-05-29T17:23:24 Z rajarshi_basu Hacker (BOI15_hac) C++14
0 / 100
12 ms 384 KB
#include <iostream>
#include <vector>
#include <set>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <stdio.h>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <complex>
#include <stack>
#include <set>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i=a;i<=b;i++)
#define ll long long int
#define vi vector<int>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define cd complex<double> 
#define ld long double
#define pld pair<ld,ld>
#define iii pair<ii,int>

const int INF = 1e9+10;
using namespace std;
const int MAXN = 1000*100*2+10;
const int MAXVAL = 1e9+10;


inline int modVal(int v,int n){
	if(v < 0)return v+2*n;
	else return n;
}

int main(){
	int n;
	cin >> n;
	int arr[2*n];
	FOR(i,n){
		cin >> arr[i];
		arr[i+n] = arr[i];
	}
	int k = (n+1)/2;
	int sum = 0;
	int sumst[2*n];
	FOR(i,k){
		sum += arr[i];
	}
	sumst[0] = sum;
	FORE(i,k,2*n-1){
		sum += arr[i]-arr[i-k];
		sumst[i-k+1] = sum; 
	}

	int mx = 0;
	FOR(i,n){
		int mn = INF;
		FORE(j,i-k+1,i+k-1){
			int jj = modVal(j,n);
			mn = min(mn,sumst[jj]);
		}
		mx = max(mx,mn);
	}
	cout << mx << endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 12 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -