Submission
Status:
[PP-SSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: Krovmoroz
Problemset: ซื้อขายหุ้นซีเค
Language: cpp
Time: 0.002 second
Submitted On: 2026-01-17 09:15:02
#include <bits/stdc++.h>
using namespace std;
int N,ans = 0;
int main() {
cin >> N;
vector<int> P(N);
for (auto &x : P) cin >> x;
int mprice = P[0];
for (auto &x : P) {
ans = max(ans, x - mprice);
if (x < mprice) mprice = x;
}
cout << ans;
return 0;
}