# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
617359 |
2022-08-01T10:58:11 Z |
Valenz |
Feast (NOI19_feast) |
C++14 |
|
162 ms |
5536 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+found}):sum+sum2) << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
5236 KB |
Output is correct |
2 |
Correct |
124 ms |
5404 KB |
Output is correct |
3 |
Correct |
126 ms |
5444 KB |
Output is correct |
4 |
Correct |
114 ms |
5480 KB |
Output is correct |
5 |
Correct |
109 ms |
5416 KB |
Output is correct |
6 |
Correct |
113 ms |
5360 KB |
Output is correct |
7 |
Correct |
120 ms |
5236 KB |
Output is correct |
8 |
Correct |
103 ms |
5416 KB |
Output is correct |
9 |
Correct |
118 ms |
5372 KB |
Output is correct |
10 |
Correct |
119 ms |
5396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
70 ms |
3584 KB |
Output is correct |
2 |
Correct |
58 ms |
3772 KB |
Output is correct |
3 |
Correct |
65 ms |
3688 KB |
Output is correct |
4 |
Correct |
63 ms |
3788 KB |
Output is correct |
5 |
Correct |
124 ms |
5376 KB |
Output is correct |
6 |
Correct |
62 ms |
3624 KB |
Output is correct |
7 |
Correct |
80 ms |
3776 KB |
Output is correct |
8 |
Correct |
124 ms |
5432 KB |
Output is correct |
9 |
Correct |
143 ms |
5360 KB |
Output is correct |
10 |
Correct |
57 ms |
3756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
162 ms |
5536 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 |
122 ms |
5236 KB |
Output is correct |
2 |
Correct |
124 ms |
5404 KB |
Output is correct |
3 |
Correct |
126 ms |
5444 KB |
Output is correct |
4 |
Correct |
114 ms |
5480 KB |
Output is correct |
5 |
Correct |
109 ms |
5416 KB |
Output is correct |
6 |
Correct |
113 ms |
5360 KB |
Output is correct |
7 |
Correct |
120 ms |
5236 KB |
Output is correct |
8 |
Correct |
103 ms |
5416 KB |
Output is correct |
9 |
Correct |
118 ms |
5372 KB |
Output is correct |
10 |
Correct |
119 ms |
5396 KB |
Output is correct |
11 |
Correct |
70 ms |
3584 KB |
Output is correct |
12 |
Correct |
58 ms |
3772 KB |
Output is correct |
13 |
Correct |
65 ms |
3688 KB |
Output is correct |
14 |
Correct |
63 ms |
3788 KB |
Output is correct |
15 |
Correct |
124 ms |
5376 KB |
Output is correct |
16 |
Correct |
62 ms |
3624 KB |
Output is correct |
17 |
Correct |
80 ms |
3776 KB |
Output is correct |
18 |
Correct |
124 ms |
5432 KB |
Output is correct |
19 |
Correct |
143 ms |
5360 KB |
Output is correct |
20 |
Correct |
57 ms |
3756 KB |
Output is correct |
21 |
Incorrect |
162 ms |
5536 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |