Submission #1017407

# Submission time Handle Problem Language Result Execution time Memory
1017407 2024-07-09T07:47:53 Z vjudge1 Feast (NOI19_feast) C++17
0 / 100
74 ms 1372 KB
#include <bits/stdc++.h>
using namespace std;

int maxSubArraySum(int a[], int size)
{
    int max_so_far = INT_MIN, max_ending_here = 0;

    for (int i = 0; i < size; i++) {
        max_ending_here = max_ending_here + a[i];
        if (max_so_far < max_ending_here)
            max_so_far = max_ending_here;

        if (max_ending_here < 0)
            max_ending_here = 0;
    }
    return max_so_far;
}

int main()
{   
    int n, k; cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int max_sum = maxSubArraySum(a, n);
    cout << max_sum;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1368 KB Output is correct
2 Correct 34 ms 1372 KB Output is correct
3 Correct 33 ms 1372 KB Output is correct
4 Incorrect 35 ms 1372 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 74 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -