답안 #24470

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 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