#include <bits/stdc++.h>
using namespace std;
#define LIFESUCKS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define ar array
#include<cstdio>
#define vt vector
#include<fstream>
ifstream fin("closing.in");
ofstream fout("closing.out");
#include<fstream>
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define fi first
#define se second
#define vt vector
using namespace std;
int main()
{
int n, k; cin >> n >> k;
ll a[n];
for(int i = 0; i < n; i++)cin >> a[i];
ll mx = a[0], cr = a[0];
for(int i = 1; i < n; i++){
cr = max(cr + a[i], a[i]);
mx = max(mx, cr);
}
cout << mx;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
116 ms |
2516 KB |
Output is correct |
2 |
Correct |
113 ms |
5416 KB |
Output is correct |
3 |
Correct |
112 ms |
5432 KB |
Output is correct |
4 |
Correct |
116 ms |
5412 KB |
Output is correct |
5 |
Correct |
135 ms |
5528 KB |
Output is correct |
6 |
Correct |
109 ms |
5364 KB |
Output is correct |
7 |
Correct |
112 ms |
5360 KB |
Output is correct |
8 |
Correct |
119 ms |
5408 KB |
Output is correct |
9 |
Correct |
122 ms |
5372 KB |
Output is correct |
10 |
Correct |
114 ms |
5400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
2572 KB |
Output is correct |
2 |
Correct |
61 ms |
3644 KB |
Output is correct |
3 |
Correct |
78 ms |
3576 KB |
Output is correct |
4 |
Incorrect |
59 ms |
3636 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
153 ms |
2600 KB |
Output is correct |
2 |
Correct |
127 ms |
2516 KB |
Output is correct |
3 |
Correct |
119 ms |
2516 KB |
Output is correct |
4 |
Correct |
125 ms |
2516 KB |
Output is correct |
5 |
Correct |
117 ms |
2592 KB |
Output is correct |
6 |
Correct |
117 ms |
2604 KB |
Output is correct |
7 |
Correct |
115 ms |
2616 KB |
Output is correct |
8 |
Correct |
144 ms |
2592 KB |
Output is correct |
9 |
Correct |
117 ms |
2516 KB |
Output is correct |
10 |
Correct |
121 ms |
2616 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
116 ms |
2516 KB |
Output is correct |
2 |
Correct |
113 ms |
5416 KB |
Output is correct |
3 |
Correct |
112 ms |
5432 KB |
Output is correct |
4 |
Correct |
116 ms |
5412 KB |
Output is correct |
5 |
Correct |
135 ms |
5528 KB |
Output is correct |
6 |
Correct |
109 ms |
5364 KB |
Output is correct |
7 |
Correct |
112 ms |
5360 KB |
Output is correct |
8 |
Correct |
119 ms |
5408 KB |
Output is correct |
9 |
Correct |
122 ms |
5372 KB |
Output is correct |
10 |
Correct |
114 ms |
5400 KB |
Output is correct |
11 |
Correct |
60 ms |
2572 KB |
Output is correct |
12 |
Correct |
61 ms |
3644 KB |
Output is correct |
13 |
Correct |
78 ms |
3576 KB |
Output is correct |
14 |
Incorrect |
59 ms |
3636 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |