Submission #826800

# Submission time Handle Problem Language Result Execution time Memory
826800 2023-08-16T04:10:17 Z devariaota Feast (NOI19_feast) C++17
30 / 100
32 ms 5604 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int n, k; cin >> n >> k;
  vector<int> a(n);
  for(int &p : a) cin >> p;
  if(k==1) {
    int ans=0, cur=0;
    for(int p : a) 
      ans=max(ans, cur=max(0LL, cur+p));
    cout << ans << '\n';
  } else {
    int ans=0;
    for(int p : a) {
      if(p>=0) ans+=p;
    }
    cout << ans << '\n';
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 5268 KB Output is correct
2 Correct 24 ms 5428 KB Output is correct
3 Correct 26 ms 5472 KB Output is correct
4 Correct 24 ms 5452 KB Output is correct
5 Correct 24 ms 5452 KB Output is correct
6 Correct 24 ms 5324 KB Output is correct
7 Correct 24 ms 5272 KB Output is correct
8 Correct 25 ms 5448 KB Output is correct
9 Correct 23 ms 5324 KB Output is correct
10 Correct 23 ms 5436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 3668 KB Output is correct
2 Correct 18 ms 3684 KB Output is correct
3 Correct 15 ms 3660 KB Output is correct
4 Correct 15 ms 3652 KB Output is correct
5 Correct 24 ms 5280 KB Output is correct
6 Correct 15 ms 3668 KB Output is correct
7 Correct 16 ms 3788 KB Output is correct
8 Correct 25 ms 5444 KB Output is correct
9 Correct 23 ms 5264 KB Output is correct
10 Correct 16 ms 3668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 5564 KB Output is correct
2 Correct 25 ms 5540 KB Output is correct
3 Correct 26 ms 5568 KB Output is correct
4 Correct 30 ms 5544 KB Output is correct
5 Correct 32 ms 5580 KB Output is correct
6 Correct 26 ms 5576 KB Output is correct
7 Correct 26 ms 5592 KB Output is correct
8 Correct 26 ms 5576 KB Output is correct
9 Correct 27 ms 5580 KB Output is correct
10 Correct 27 ms 5604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 316 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 5268 KB Output is correct
2 Correct 24 ms 5428 KB Output is correct
3 Correct 26 ms 5472 KB Output is correct
4 Correct 24 ms 5452 KB Output is correct
5 Correct 24 ms 5452 KB Output is correct
6 Correct 24 ms 5324 KB Output is correct
7 Correct 24 ms 5272 KB Output is correct
8 Correct 25 ms 5448 KB Output is correct
9 Correct 23 ms 5324 KB Output is correct
10 Correct 23 ms 5436 KB Output is correct
11 Correct 15 ms 3668 KB Output is correct
12 Correct 18 ms 3684 KB Output is correct
13 Correct 15 ms 3660 KB Output is correct
14 Correct 15 ms 3652 KB Output is correct
15 Correct 24 ms 5280 KB Output is correct
16 Correct 15 ms 3668 KB Output is correct
17 Correct 16 ms 3788 KB Output is correct
18 Correct 25 ms 5444 KB Output is correct
19 Correct 23 ms 5264 KB Output is correct
20 Correct 16 ms 3668 KB Output is correct
21 Correct 30 ms 5564 KB Output is correct
22 Correct 25 ms 5540 KB Output is correct
23 Correct 26 ms 5568 KB Output is correct
24 Correct 30 ms 5544 KB Output is correct
25 Correct 32 ms 5580 KB Output is correct
26 Correct 26 ms 5576 KB Output is correct
27 Correct 26 ms 5592 KB Output is correct
28 Correct 26 ms 5576 KB Output is correct
29 Correct 27 ms 5580 KB Output is correct
30 Correct 27 ms 5604 KB Output is correct
31 Correct 0 ms 316 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Incorrect 1 ms 212 KB Output isn't correct
34 Halted 0 ms 0 KB -