Submission #564966

#TimeUsernameProblemLanguageResultExecution timeMemory
564966CookieFeast (NOI19_feast)C++14
22 / 100
153 ms5528 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...