#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; cin >> n;
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 |
Incorrect |
117 ms |
5360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
66 ms |
3592 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
5536 KB |
Output is correct |
2 |
Correct |
120 ms |
5516 KB |
Output is correct |
3 |
Correct |
120 ms |
5524 KB |
Output is correct |
4 |
Correct |
115 ms |
5504 KB |
Output is correct |
5 |
Correct |
129 ms |
5532 KB |
Output is correct |
6 |
Correct |
125 ms |
5544 KB |
Output is correct |
7 |
Correct |
122 ms |
5568 KB |
Output is correct |
8 |
Correct |
123 ms |
5580 KB |
Output is correct |
9 |
Correct |
121 ms |
5684 KB |
Output is correct |
10 |
Correct |
123 ms |
5552 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
312 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
117 ms |
5360 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |