#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define ull unsigned long long
#define ssort sort(s.begin(),s.end());
#define sreverse reverse(s.begin(),s.end());
#define sclear s.clear();
#define ssize s.size();
#define ld long double
#define F first
#define S second
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define sq(a) (a)*(a)
/*void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}*/
ll a,b,c,e,d,f,k,g,h,q[2000000],i,j,x,y,z,m,n,l,r,w,t,p,s,u,sum,ans,mod=1e18;
vector <int> v;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(i=1;i<=n;i++)
{
cin>>q[i];
}
l=1;
for(i=1;i<=n;i++)
{
if(i==1) x=q[i];
k=0;
while(k<x&&i<n){
i++;
k+=q[i];
}
if(k>=x) x=k,l++;
}
cout<<l;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |