Submission #997934

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9979342024-06-13 06:56:04arbuzickCigle (COI21_cigle)C++17
100 / 100
403 ms97464 KiB
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 5e3 + 5;
int dp[maxn][maxn];
void solve() {
int n;
cin >> n;
vector<int> d(n);
for (int i = 0; i < n; ++i) {
cin >> d[i];
}
for (int r = 1; r < n; ++r) {
vector<int> pr_sum_left = {0}, pr_sum_right = {0};
vector<int> pr_max(r + 1);
for (int i = 0; i < r; ++i) {
pr_max[i + 1] = max(pr_max[i], dp[i][r]);
}
for (int i = r - 1; i >= 0; --i) {
pr_sum_left.push_back(pr_sum_left.back() + d[i]);
}
for (int i = r; i < n; ++i) {
pr_sum_right.push_back(pr_sum_right.back() + d[i]);
}
int ans_nw = pr_max[r], cnt_nw = 0;
for (int r2 = r + 1; r2 <= n; ++r2) {
dp[r][r2] = ans_nw;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cigle.cpp: In function 'void solve()':
cigle.cpp:32:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |             if (pos != pr_sum_left.size() && pr_sum_left[pos] == pr_sum_right[r2 - r]) {
      |                 ~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...