This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |