# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
510083 |
2022-01-14T16:43:10 Z |
Rasoul006 |
Nizin (COCI16_nizin) |
C++17 |
|
66 ms |
4208 KB |
#include <bits/stdc++.h>
#define endl "\n" ;
typedef long long ll ;
using namespace std;
int a[5555555];
ll n,l,r,ans;
int main()
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
for (int i=0 ; i<n ; i++)
{
cin>>a[i];
}
if (n==1)
{
cout<<0;
return 0;
}
r = n-1;
while (l<=r)
{
if (a[r]==a[l])
{
r--;
l++;
}
else if (a[r]<a[l])
{
a[r-1]+=a[r];
r--;
ans++;
}
else if (a[l]<a[r])
{
a[l+1]+= a[l] ;
l++;
ans++;
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
612 KB |
Output is correct |
2 |
Correct |
6 ms |
588 KB |
Output is correct |
3 |
Correct |
5 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1672 KB |
Output is correct |
2 |
Correct |
31 ms |
1948 KB |
Output is correct |
3 |
Correct |
35 ms |
2160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
3224 KB |
Output is correct |
2 |
Correct |
45 ms |
3436 KB |
Output is correct |
3 |
Correct |
55 ms |
3760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
4044 KB |
Output is correct |
2 |
Correct |
66 ms |
4096 KB |
Output is correct |
3 |
Correct |
58 ms |
4208 KB |
Output is correct |