Submission #247702

# Submission time Handle Problem Language Result Execution time Memory
247702 2020-07-12T02:45:35 Z MohamedAhmed04 Hacker (BOI15_hac) C++14
0 / 100
0 ms 384 KB
#include <bits/stdc++.h>

using namespace std ;

const int MAX = 5e5 + 10 ;

int arr[MAX] , pref[MAX] ;
int n ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>n ;
	for(int i = 1 ; i <= n ; ++i)
		cin>>arr[i] ;
	int sum = 0 ;
	for(int i = 1 ; i <= n ; ++i)
	{
		pref[i] = pref[i-1] + arr[i] ;
		sum += arr[i] ;
	}
	priority_queue<int>q ;
	int a = (n+1) / 2 , b = n/2 ;
	for(int i = 1 ; i <= n ; ++i)
	{
		if(i+a-1 <= n)
			q.push(pref[i+a-1] - pref[i-1]) ;
		if(i+b-1 < n)
			q.push(sum - (pref[i+b-1] - pref[i-1])) ;
	}
	q.pop() ;
	return cout<<q.top()<<"\n" , 0 ;
}		
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -