Submission #950556

# Submission time Handle Problem Language Result Execution time Memory
950556 2024-03-20T12:33:22 Z VMaksimoski008 Feast (NOI19_feast) C++14
18 / 100
93 ms 4552 KB
#include <bits/stdc++.h>

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
//#define int long long

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 1e5 + 5;
const double eps = 1e-9;

int32_t main() {
    int n, k, neg = 0;
    cin >> n >> k;

    vector<int> v(n+1);
    for(int i=1; i<=n; i++) cin >> v[i], neg += (v[i] < 0);

    if(k == 1) {
        ll ans = 0, sum = 0, mn = 0;

        for(int i=1; i<=n; i++) {
            sum += v[i];
            ans = max(ans, sum - mn);
            mn = min(mn, sum);
        }

        cout << ans << '\n';
        return 0;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 81 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 44 ms 1368 KB Output is correct
2 Correct 44 ms 2492 KB Output is correct
3 Correct 58 ms 2680 KB Output is correct
4 Incorrect 43 ms 2648 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 90 ms 1372 KB Output is correct
2 Correct 88 ms 4552 KB Output is correct
3 Correct 93 ms 4380 KB Output is correct
4 Correct 87 ms 4492 KB Output is correct
5 Correct 90 ms 4500 KB Output is correct
6 Correct 90 ms 4516 KB Output is correct
7 Correct 89 ms 4432 KB Output is correct
8 Correct 88 ms 4436 KB Output is correct
9 Correct 93 ms 4436 KB Output is correct
10 Correct 89 ms 4436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 81 ms 1372 KB Output isn't correct
2 Halted 0 ms 0 KB -