답안 #131149

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131149 2019-07-16T17:01:54 Z youssefbou62 Hacker (BOI15_hac) C++14
40 / 100
94 ms 504 KB
#include  <bits/stdc++.h>

using namespace std;

#define mp make_pair
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define allarr(a) a , a + n
#define ll long long
#define ull unsigned long long 
#define pb push_back
#define fastio ios_base::sync_with_stdio(false) ; cin.tie(NULL); cout.tie(NULL)
typedef pair<int, int> pi;
typedef pair<ll,ll> pll; 
typedef pair<int,pi> trp ;
typedef vector<pi> vpi;
typedef vector<pll> vpll ;
// int ab  (int  x ) { return (x>0?x:-x); }

const int N = 5005 ;
int a[N] , pref[N],n; 

int sum(int l , int r ){
	if( l > r )return 0; 
	if( l == 0 )return pref[r]; 
	return pref[r]-pref[l-1] ; 
}

int main(){
cin >> n ; 
for(int i= 0 ;  i< n ; i++ )cin >> a[i] ; 
pref[0] = a[0] ; 
for(int i =  1 ; i < n ; i++ ){
	pref[i] = pref[i-1] + a[i] ; 
}
int ans = 0; 
for(int start = 0 ; start < n ; start ++ ){
	int left , cnt = 1e9; 
	for(int right = 1 ; right <= (n/2)+(n%2) ; right ++ ){
		left = (n/2+n%2)-right; 
		int s = sum(start,min(n-1,start+right-1)); 
		s += sum(0,right - (n+1-start) ) ; 
		s += sum(max(0,start-left),start-1);
		s += sum(n-(left-start),n-1);
		cnt = min(s,cnt);

	}
	ans = max ( cnt , ans ) ; 
}
cout << ans << endl; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 3 ms 296 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 3 ms 296 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 4 ms 376 KB Output is correct
22 Correct 31 ms 376 KB Output is correct
23 Correct 82 ms 376 KB Output is correct
24 Correct 30 ms 376 KB Output is correct
25 Correct 94 ms 376 KB Output is correct
26 Correct 79 ms 412 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 82 ms 376 KB Output is correct
31 Correct 80 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 79 ms 504 KB Output is correct
4 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 380 KB Output is correct
16 Correct 3 ms 296 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 6 ms 376 KB Output is correct
21 Correct 4 ms 376 KB Output is correct
22 Correct 31 ms 376 KB Output is correct
23 Correct 82 ms 376 KB Output is correct
24 Correct 30 ms 376 KB Output is correct
25 Correct 94 ms 376 KB Output is correct
26 Correct 79 ms 412 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 3 ms 256 KB Output is correct
29 Correct 2 ms 376 KB Output is correct
30 Correct 82 ms 376 KB Output is correct
31 Correct 80 ms 448 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 3 ms 256 KB Output is correct
34 Correct 79 ms 504 KB Output is correct
35 Runtime error 5 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Halted 0 ms 0 KB -