Submission #18302528


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int64_t> A_vec(N);
for (int i = 0; i < N; ++i)
cin >> A_vec.at(i);
vector<vector<int64_t>> dp(N + 1, vector<int64_t>(N, 0));
for (int k = 0; k < N; ++k) {
for (int i = 0, j = k; j < N; ++i, ++j)
dp[k + 1][i] = dp[k][i] + A_vec.at(j);
}
for (int k = 1; k < N + 1; ++k)
cout << *max_element(dp.at(k).begin(), dp.at(k).end()) << endl;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int64_t> A_vec(N);
    for (int i = 0; i < N; ++i)
        cin >> A_vec.at(i);
    vector<vector<int64_t>> dp(N + 1, vector<int64_t>(N, 0));
    for (int k = 0; k < N; ++k) {
        for (int i = 0, j = k; j < N; ++i, ++j) 
            dp[k + 1][i] = dp[k][i] + A_vec.at(j);
    }
    for (int k = 1; k < N + 1; ++k)
        cout << *max_element(dp.at(k).begin(), dp.at(k).end()) << endl;
}

Submission Info

Submission Time
Task A - Abundant Resources
User atug
Language C++ (GCC 9.2.1)
Score 200
Code Size 487 Byte
Status AC
Exec Time 72 ms
Memory 73676 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 13
Set Name Test Cases
Sample sample-01.txt, sample-02.txt, sample-03.txt
All 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, sample-01.txt, sample-02.txt, sample-03.txt
Case Name Status Exec Time Memory
01-01.txt AC 6 ms 3544 KB
01-02.txt AC 18 ms 6876 KB
01-03.txt AC 10 ms 5596 KB
01-04.txt AC 36 ms 34088 KB
01-05.txt AC 43 ms 39864 KB
01-06.txt AC 36 ms 36360 KB
01-07.txt AC 51 ms 49760 KB
01-08.txt AC 68 ms 73676 KB
01-09.txt AC 72 ms 73504 KB
01-10.txt AC 72 ms 73656 KB
sample-01.txt AC 2 ms 3576 KB
sample-02.txt AC 2 ms 3500 KB
sample-03.txt AC 2 ms 3596 KB


2025-04-05 (Sat)
22:46:51 +00:00