Submission

Status:
[PPPPPPPPPP]

Score: 100

User: Dormon

Problemset: stock

Language: cpp

Time: 0.007 second

Submitted On: 2025-03-26 12:26:07

#include <iostream>
#include <vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    long long ans = 0ll, mn = 1e9 + 0ll;
    cin >> n;

    vector<long long> v(n + 1);
    for (int i = 1;i <= n;i++){
        cin >> v[i];
        mn = min(mn, v[i]);
        ans = max(ans, v[i] - mn);
    }

    cout << ans << '\n';

}