Submission

Status:

[PP-SSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: nemuchannnUwU

Problemset: ซื้อขายหุ้นซีเค

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-11 23:02:27

#include<bits/stdc++.h>
#define int long long
using namespace std;
main(){
	cin.tie(nullptr)->sync_with_stdio(0);
	int n; cin >> n;
	vector<int> v(n);
	for(auto &x : v) cin >> x;
	int mx=0;
	int mn=LLONG_MAX;
	for (auto x : v){
		if (x<mn){
			mn=x;
		}
		int prof=x-mn;
		mx=max(mx,prof);
	}
	cout << mx;
}