| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 489991 | hoanghq2004 | Bigger segments (IZhO19_segments) | C++14 | 1593 ms | 98544 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
const int Nmax = 5010;
int n;
long long s[Nmax];
int f[Nmax][Nmax];
int main() {
ios :: sync_with_stdio(0); cin.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> s[i];
s[i] += s[i - 1];
}
memset(f, -60, sizeof(f));
for (int i = 1; i <= n; ++i) f[i][1] = 0;
for (int l = 2; l <= n; ++l) {
// int j = l - 1;
// while (j <= )
for (int i = l, j = l - 1; i <= n; ++i) {
for (int j = l - 1; j < i; ++j) {
if (f[j][l - 1] < 0) continue;
if (s[i] - s[j] >= s[j] - s[f[j][l - 1]]) f[i][l] = j;// cout << l << ' ' << i << ' ' << j << '\n';
}
}
}
int ans = 0;
for (int i = 1; i <= n; ++i) if (f[n][i] >= 0) ans = i;
cout << ans;
}
컴파일 시 표준 에러 (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... | ||||
