Submission #510255

# Submission time Handle Problem Language Result Execution time Memory
510255 2022-01-14T21:16:54 Z salamhassan Nizin (COCI16_nizin) C++14
0 / 100
1000 ms 8308 KB
#include <bits/stdc++.h>
using namespace std;
int a[1000007],n,l,r,ans;
int main()
{
    cin>>n;
    for (int i=0; i<n; i++)
    {
        cin>>a[i];
    }
    l=0;
    r=n-1;
    while (l<n)
    {
        if (a[l]==a[r])
        {
        l++;
            r--;
        }
        while (r>0 && a[l]!=a[r])
        {
        if (a[l]>a[r])
        {
            a[r-1]+=a[r];
            r--;
            ans++;
        }
        else
        {
        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 Execution timed out 1089 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 51 ms 8308 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 3188 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 4064 KB Time limit exceeded
2 Halted 0 ms 0 KB -