Submission #1030857

#TimeUsernameProblemLanguageResultExecution timeMemory
1030857UnforgettableplSecurity Guard (JOI23_guard)C++17
25 / 100
18 ms4196 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,m,q; cin >> n >> m >> q; vector<int> arr(n+1); for(int i=1;i<=n;i++)cin>>arr[i]; int ans = 0; int curr = 0; for(int i=1;i<n;i++){ ans+=arr[i]; curr+=arr[i]; curr-=arr[i+1]; if(curr<0){ ans-=curr; curr = 0; } } cout << ans << '\n'; }
#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...