Submission #499112

# Submission time Handle Problem Language Result Execution time Memory
499112 2021-12-27T08:50:07 Z Abdurahmon Bigger segments (IZhO19_segments) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n;
cin>>n;
int a[n];
for(int c=0;c<n;c++)
{
	cin>>a[c];
}
if(n==1)
{
	cout<<1;
	return 0;
}
int ans=1,s=0,s1=a[0];
for(int c=1;c<n;c++)
{
	s+=a[c];
	if(s>=s1)
	{
		//cout<<s1<<" "<<s<<"\n";
		ans++;
		s1=s;
		s=0;
	}
}
cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -