Submission #74101

# Submission time Handle Problem Language Result Execution time Memory
74101 2018-08-30T05:43:11 Z charlies_moo Nizin (COCI16_nizin) C++14
100 / 100
210 ms 19280 KB
#include <cstdio>
#include <iostream> 

using namespace std;

int n;
int a[1000001];
int l,r;
int ans;

int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	l=1,r=n;
	while(l-1<r)
	{
		if(a[l]==a[r])
		{
			l++,r--;
			continue;
		}
		if(a[l]>a[r])
		{
			a[r-1]+=a[r];
			r--;
			ans++;
		}
		else
		{
			a[l+1]+=a[l];
			l++;
			ans++;
		}
	}
	cout<<ans; 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 2 ms 888 KB Output is correct
3 Correct 2 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 940 KB Output is correct
2 Correct 2 ms 940 KB Output is correct
3 Correct 2 ms 940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 940 KB Output is correct
2 Correct 2 ms 968 KB Output is correct
3 Correct 2 ms 1016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1020 KB Output is correct
2 Correct 3 ms 1024 KB Output is correct
3 Correct 2 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1032 KB Output is correct
2 Correct 2 ms 1056 KB Output is correct
3 Correct 2 ms 1056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1448 KB Output is correct
2 Correct 22 ms 1752 KB Output is correct
3 Correct 22 ms 2008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 3716 KB Output is correct
2 Correct 89 ms 4896 KB Output is correct
3 Correct 105 ms 6148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 154 ms 8844 KB Output is correct
2 Correct 165 ms 10572 KB Output is correct
3 Correct 189 ms 12920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 207 ms 15116 KB Output is correct
2 Correct 209 ms 17248 KB Output is correct
3 Correct 210 ms 19280 KB Output is correct