Submission #510278

# Submission time Handle Problem Language Result Execution time Memory
510278 2022-01-14T21:58:23 Z basheer Nizin (COCI16_nizin) C++17
0 / 100
1000 ms 4044 KB
#include <bits/stdc++.h>
using namespace std;
int x,y,n,sum1,sum2,ans;
int main()
{
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++)
        cin>>a[i];
    x=0;
    y=n-1;
    sum1=0;
    sum2=0;
    while(y>x)
    {
        if(a[y]==a[x])
        {
            y--;
            x++;
            sum1=0;
            sum2=0;
            continue;
        }
        if(a[y]>a[x])
        {
            sum1+=a[x];
            x++;
            sum2+=a[y];
            y--;
        }
        while(sum1!=sum2)
        {
            if(sum2>sum1)
            {
                sum1+=a[x];
                x++;
            }
            else
            {
                sum2+=a[y];
                y--;
            }
            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 1087 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 1612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 3148 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 4044 KB Time limit exceeded
2 Halted 0 ms 0 KB -