답안 #1025600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1025600 2024-07-17T08:02:49 Z fv3 Feast (NOI19_feast) C++14
22 / 100
25 ms 8028 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int N, K;
	cin >> N >> K;

	vector<ll> a(N);
	for (int i = 0; i < N; i++)
		cin >> a[i];

	// K = 1
	vector<ll> prefixSum(N);
	ll minPrefix = 0;
	ll res = 0;

	for (int i = 0; i < N; i++)
	{
		if (i) prefixSum[i] = prefixSum[i-1];
		prefixSum[i] += a[i];
		minPrefix = min(minPrefix, prefixSum[i]);
		res = max(res, prefixSum[i] - minPrefix);
	}
	cout << res << '\n';

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 7764 KB Output is correct
2 Correct 21 ms 7764 KB Output is correct
3 Correct 20 ms 8028 KB Output is correct
4 Correct 22 ms 7956 KB Output is correct
5 Correct 24 ms 7880 KB Output is correct
6 Correct 21 ms 7772 KB Output is correct
7 Correct 21 ms 7596 KB Output is correct
8 Correct 22 ms 7772 KB Output is correct
9 Correct 21 ms 7764 KB Output is correct
10 Correct 22 ms 7772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 5972 KB Output is correct
2 Correct 15 ms 6236 KB Output is correct
3 Correct 14 ms 5940 KB Output is correct
4 Incorrect 15 ms 5980 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 8016 KB Output is correct
2 Correct 23 ms 8020 KB Output is correct
3 Correct 23 ms 8020 KB Output is correct
4 Correct 23 ms 7760 KB Output is correct
5 Correct 25 ms 8028 KB Output is correct
6 Correct 25 ms 8016 KB Output is correct
7 Correct 24 ms 8016 KB Output is correct
8 Correct 24 ms 8020 KB Output is correct
9 Correct 24 ms 8020 KB Output is correct
10 Correct 25 ms 8016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 20 ms 7764 KB Output is correct
2 Correct 21 ms 7764 KB Output is correct
3 Correct 20 ms 8028 KB Output is correct
4 Correct 22 ms 7956 KB Output is correct
5 Correct 24 ms 7880 KB Output is correct
6 Correct 21 ms 7772 KB Output is correct
7 Correct 21 ms 7596 KB Output is correct
8 Correct 22 ms 7772 KB Output is correct
9 Correct 21 ms 7764 KB Output is correct
10 Correct 22 ms 7772 KB Output is correct
11 Correct 16 ms 5972 KB Output is correct
12 Correct 15 ms 6236 KB Output is correct
13 Correct 14 ms 5940 KB Output is correct
14 Incorrect 15 ms 5980 KB Output isn't correct
15 Halted 0 ms 0 KB -