Submission #95090

# Submission time Handle Problem Language Result Execution time Memory
95090 2019-01-27T08:22:22 Z Rouge_Hugo Nizin (COCI16_nizin) C++14
70 / 100
9 ms 1704 KB
#include <bits/stdc++.h>
using namespace std;
int a[100009];

int main()
{ios_base::sync_with_stdio(false);
cin.tie(NULL);
	int n;cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int re=0;
	long long  sum=0,sum1=0;
	for(int i=0,j=n-1;i<n,j>-1;i++,j--)
	{
		sum+=a[i];
		sum1+=a[j];
		while (sum!=sum1&&i<j)
		{
			if (sum>sum1)
			{re++;
				j--;
				sum1+=a[j];
				continue;
			}
			else if (sum1>sum)
			{
				re++;
				i++;
				sum+=a[i];
				continue;
			}
			else break;
		}
	}
cout<<re;
 return 0;

}

Compilation message

nizin.cpp: In function 'int main()':
nizin.cpp:15:21: warning: left operand of comma operator has no effect [-Wunused-value]
  for(int i=0,j=n-1;i<n,j>-1;i++,j--)
                    ~^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory Grader output
1 Correct 7 ms 888 KB Output is correct
2 Correct 8 ms 888 KB Output is correct
3 Correct 8 ms 892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 1704 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 1656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 1656 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -