Submission #31577

# Submission time Handle Problem Language Result Execution time Memory
31577 2017-08-30T01:52:37 Z huynd2001 Hacker (BOI15_hac) C++14
20 / 100
59 ms 9828 KB
/*huypheu
4
6 8 4 7
*/

#include <bits/stdc++.h>
#define int long long
using namespace std;

int a[500007];
int su[500007];

signed main()
{
	int n;
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
	}
	int la=(n/2);
	for(int i=1;i<=n;i++)
	{
		su[i]=su[i-1]+a[i];
	}
	int mi=0;
	for(int i=2;i<=n-la+1;i++)
	{
		mi=max(mi,su[i+la-1]-su[i-1]);
	}
	printf("%lld",su[n]-mi);
	return 0;
}

Compilation message

hac.cpp: In function 'int main()':
hac.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
                  ^
hac.cpp:19:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld",&a[i]);
                      ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 9828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 9828 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 9828 KB Output is correct
2 Correct 0 ms 9828 KB Output is correct
3 Correct 0 ms 9828 KB Output is correct
4 Correct 6 ms 9828 KB Output is correct
5 Correct 23 ms 9828 KB Output is correct
6 Correct 33 ms 9828 KB Output is correct
7 Correct 56 ms 9828 KB Output is correct
8 Correct 59 ms 9828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 9828 KB Output isn't correct
2 Halted 0 ms 0 KB -