# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
291152 | thiago4532 | Bigger segments (IZhO19_segments) | C++17 | 3 ms | 640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int int64_t
using namespace std;
const int maxn = 5e5 + 10;
typedef long long ll;
int dp[maxn], bb[maxn];
int n, v[maxn], pref[maxn];
int32_t main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
pref[i] = pref[i-1] + v[i];
}
for (int i = 1; i <= n; i++) {
bb[i] = max(bb[i], bb[i-1]);
dp[i] = dp[ bb[i] ] + 1;
int soma = pref[i] - pref[bb[i]];
int ini = i+1, fim = n, meio, best;
while (ini <= fim) {
meio = (ini + fim) >> 1;
if (pref[meio] + pref[ bb[i] ] >= 2*pref[i]) {
fim = meio-1;
best = meio;
}else
ini = meio+1;
}
bb[best] = i;
}
cout << dp[n] << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |