Submission #511430

# Submission time Handle Problem Language Result Execution time Memory
511430 2022-01-15T18:55:16 Z Mulhamadlah Nizin (COCI16_nizin) C++14
10 / 100
124 ms 7916 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
ll n;
ll a[1000009];
int main()
{
    cin>>n;
    for(ll i=0;i<n;i++)
        cin>>a[i];
    ll i=0,j=n-1,ans=0;
    while(abs(i-j)>1)
    {
        if(a[i]!=a[j])
        {
            if(a[i+1]+a[i]==a[j])
                {a[i+1]+=a[i];
                ans++;}
            else if(a[i]==a[j-1]+a[j])
                {a[j-1]+=a[j];
                ans++;}
            else
            {
                a[i+1]+=a[i];
                a[j-1]+=a[j];
                ans+=2;
            }

        }
i++;
j--;

    }
    if(n%2==0)
    {
        if(a[(n+1)/2]!=a[(n+1)/2+1])
            ans++;
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 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 1 ms 204 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 55 ms 3000 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 124 ms 6144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 7916 KB Output isn't correct
2 Halted 0 ms 0 KB -