Submission #114043

# Submission time Handle Problem Language Result Execution time Memory
114043 2019-05-29T17:34:48 Z rajarshi_basu Hacker (BOI15_hac) C++14
40 / 100
1000 ms 2428 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 if(v >= 2*n)return v-2*n;
	else return n;
}

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

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

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 400 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 400 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 13 ms 512 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 13 ms 384 KB Output is correct
26 Correct 12 ms 380 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 13 ms 512 KB Output is correct
31 Correct 12 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 13 ms 512 KB Output is correct
4 Execution timed out 1081 ms 2428 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 400 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 256 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 6 ms 384 KB Output is correct
23 Correct 13 ms 512 KB Output is correct
24 Correct 6 ms 384 KB Output is correct
25 Correct 13 ms 384 KB Output is correct
26 Correct 12 ms 380 KB Output is correct
27 Correct 2 ms 256 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 13 ms 512 KB Output is correct
31 Correct 12 ms 512 KB Output is correct
32 Correct 2 ms 256 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 13 ms 512 KB Output is correct
35 Execution timed out 1081 ms 2428 KB Time limit exceeded
36 Halted 0 ms 0 KB -