# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
510080 |
2022-01-14T16:38:53 Z |
Rasoul006 |
Nizin (COCI16_nizin) |
C++17 |
|
30 ms |
9256 KB |
#include <bits/stdc++.h>
#define endl "\n" ;
typedef long long ll ;
using namespace std;
ll a[555555];
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 |
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 |
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 |
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 |
224 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 |
4 ms |
844 KB |
Output is correct |
2 |
Correct |
6 ms |
972 KB |
Output is correct |
3 |
Correct |
5 ms |
1100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
3020 KB |
Output is correct |
2 |
Correct |
22 ms |
3576 KB |
Output is correct |
3 |
Correct |
28 ms |
4136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
30 ms |
9172 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
29 ms |
9256 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |