| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1363243 | vlad7654 | Bigger segments (IZhO19_segments) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
vector<int> dp(n + 1, 0);
vector<int> min_s(n + 1, 0);
vector<int> pref(n + 1, 0);
for (int i = 0; i < n; i++) pref[i+1] = pref[i] + a[n-1-i];
int j = 0;
for (int i = 1; i <= n; i++) {
while (j + 1 < i and pref[i] - pref[j+1] >= min_s[j+1]) {
j++;
}
dp[i] = dp[j] + 1;
min_s[i] = pref[i] - pref[j];
}
cout << dp[n];
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
