답안 #968687

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
968687 2024-04-23T20:14:07 Z RandomUser Nizin (COCI16_nizin) C++17
100 / 100
116 ms 10160 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
 
int main() {
    int n;
    cin >> n;
 
    vector<ll> v(n);
    for(ll &x : v) cin >> x;
 
    int i=0, j=n-1;
    int ans = 0;
 
    while(i < j) {
        if(v[i] == v[j]) {
            i++, j--;
            continue;
        }
 
        ans++;
        if(v[i] < v[j]) v[i+1] += v[i], i++;
        else v[j-1] += v[j], j--;
    }
 
    cout << ans << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 436 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 1116 KB Output is correct
2 Correct 11 ms 1372 KB Output is correct
3 Correct 12 ms 1436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 3652 KB Output is correct
2 Correct 49 ms 4440 KB Output is correct
3 Correct 57 ms 5200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 84 ms 7876 KB Output is correct
2 Correct 89 ms 8588 KB Output is correct
3 Correct 106 ms 9232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 9912 KB Output is correct
2 Correct 114 ms 10160 KB Output is correct
3 Correct 116 ms 10068 KB Output is correct