답안 #594241

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594241 2022-07-12T09:14:39 Z vuavisao Nizin (COCI16_nizin) C++14
100 / 100
58 ms 10172 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define ll long long
using namespace std;

const int N = 1e6 + 10;

int n;
ll a[N];

int res;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a[i];
    for(int l = 1, r = n; l <= r;)
    {
        while(a[l] != a[r])
        {
            if(a[l] < a[r])
            {
                l++;
                a[l] += a[l - 1];
            }
            else
            {
                r--;
                a[r] += a[r + 1];
            }
            res++;
        }
        l++;
        r--;
    }
    cout << res;
    return 0;
}

/// Code by vuavisao
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 976 KB Output is correct
2 Correct 5 ms 1236 KB Output is correct
3 Correct 7 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 3688 KB Output is correct
2 Correct 23 ms 4492 KB Output is correct
3 Correct 27 ms 5200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 7880 KB Output is correct
2 Correct 58 ms 8116 KB Output is correct
3 Correct 52 ms 9104 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 9932 KB Output is correct
2 Correct 53 ms 10172 KB Output is correct
3 Correct 52 ms 10116 KB Output is correct