# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
848392 |
2023-09-12T11:34:35 Z |
A203_Dream |
Feast (NOI19_feast) |
C++17 |
|
10 ms |
3268 KB |
#include<bits/stdc++.h>
#define int long long
using namespace std ;
const int maxn=1e5+5 ;
int n, k, a[maxn], cntn=0 ;
namespace sub1{
int ans=0 ;
void Solve(){
for(int i=1 ; i<=n ; i++) ans+=a[i] ;
cout << ans ;
}
}
namespace sub3{
int bs=INT_MIN, res=0 ;
void Solve(){
for(int i=1 ; i<=n ; i++){
res=max(a[i], res+a[i]) ;
bs=max(bs, res) ;
}
cout << bs ;
}
}
signed main(){
ios_base::sync_with_stdio(false) ;
cin.tie(0) ;
cin >> n >> k ;
for(int i=1 ; i<=n ; i++){
cin >> a[i] ;
if(a[i]<0) cntn++ ;
}
if(cntn==0&&k!=1) sub1 :: Solve() ;
if(k==1) sub3:: Solve() ;
return 0 ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
10 ms |
3268 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1628 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
2472 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
10 ms |
3268 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |