Submission #24470

# Submission time Handle Problem Language Result Execution time Memory
24470 2017-06-09T09:47:15 Z toonewbie Nizin (COCI16_nizin) C++14
100 / 100
213 ms 11664 KB
#include <bits/stdc++.h>
#define intt long long
using namespace std;
intt minop(intt arr[], intt n)
{
    intt ans = 0;
    for (int i=0,j=n-1; i<=j;)
    {
        if (arr[i] == arr[j])
        {
            i++;
            j--;
        }
        else if (arr[i] > arr[j])
        {
            j--;
            arr[j] += arr[j+1] ;
            ans++;
        }

        else
        {
            i++;
            arr[i] += arr[i-1];
            ans++;
        }
    }

    return ans;
}
intt arr[1234567];
int main()
{
    intt n;
    cin>>n;
    for(intt i=0;i<n;i++)cin>>arr[i];
    cout<<minop(arr,n)<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 11664 KB Output is correct
2 Correct 0 ms 11664 KB Output is correct
3 Correct 0 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 11664 KB Output is correct
2 Correct 16 ms 11664 KB Output is correct
3 Correct 16 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 11664 KB Output is correct
2 Correct 96 ms 11664 KB Output is correct
3 Correct 96 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 11664 KB Output is correct
2 Correct 159 ms 11664 KB Output is correct
3 Correct 213 ms 11664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 11664 KB Output is correct
2 Correct 213 ms 11664 KB Output is correct
3 Correct 203 ms 11664 KB Output is correct