Submission

Status:
[PPPPPPPPPP]

Score: 100

User: hmmm

Problemset: stock

Language: cpp

Time: 0.012 second

Submitted On: 2025-03-25 15:41:26

#include<bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n;
    cin >> n;
    int x;
    cin >> x;
    int mn=x,ans=0;
    for(int i=2;i<=n;i++){
        // int x;
        cin >> x;
        ans=max(x-mn,ans);
        mn=min(mn,x);
    }
    cout << ans;
}