Submission #617269

# Submission time Handle Problem Language Result Execution time Memory
617269 2022-08-01T10:16:09 Z Valenz Feast (NOI19_feast) C++14
4 / 100
127 ms 2644 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
signed main()
{
	int n,k;
	cin >> n >> k;
	vector<int> a(n+1);
	int sum=0,sum2=0;
	int found=0;
	for(int i=1;i<=n;i++)
	{
		cin >> a[i];
		if(a[i]<0)
		{
			found=a[i];
			continue;
		}
		if(found==0)
		{
			sum+=a[i];
		}
		else

		{
			sum2+=a[i];
		}
	}
	cout << (k==1?max(sum,sum2):sum+sum2) << '\n';

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 108 ms 2564 KB Output is correct
2 Correct 114 ms 2612 KB Output is correct
3 Correct 120 ms 2644 KB Output is correct
4 Correct 106 ms 2620 KB Output is correct
5 Correct 104 ms 2612 KB Output is correct
6 Correct 112 ms 2572 KB Output is correct
7 Correct 119 ms 2516 KB Output is correct
8 Correct 109 ms 2616 KB Output is correct
9 Correct 127 ms 2572 KB Output is correct
10 Correct 103 ms 2596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2584 KB Output is correct
2 Incorrect 63 ms 2644 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 127 ms 2612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 108 ms 2564 KB Output is correct
2 Correct 114 ms 2612 KB Output is correct
3 Correct 120 ms 2644 KB Output is correct
4 Correct 106 ms 2620 KB Output is correct
5 Correct 104 ms 2612 KB Output is correct
6 Correct 112 ms 2572 KB Output is correct
7 Correct 119 ms 2516 KB Output is correct
8 Correct 109 ms 2616 KB Output is correct
9 Correct 127 ms 2572 KB Output is correct
10 Correct 103 ms 2596 KB Output is correct
11 Correct 56 ms 2584 KB Output is correct
12 Incorrect 63 ms 2644 KB Output isn't correct
13 Halted 0 ms 0 KB -