Submission
Status:
[PPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: anonymous
Problemset: stock
Language: cpp
Time: 0.009 second
Submitted On: 2026-11-03 23:35:53
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
int stock,carry = 2e9 + 5,ans = 0;
for(int i=0;i<n;i++){
cin >> stock;
carry = min(carry, stock);
ans = max(ans, stock - carry);
}
cout << ans << '\n';
return 0;
}