Submission
Status:
PP--------
Score: 20
User: punghy
Problemset: Fool's Compensation
Language: cpp
Time: 0.003 second
Submitted On: 2025-03-19 13:27:40
#include<bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int time;
cin>>time;
vector<int> per(time),cash(time);
for(int i=0;i<time;i++) {
cash[i] = 1000;
}
for(int i=0;i<time;i++) {
cin>>per[i];
if (i!=0) {
if (per[i]>per[i-1]) {
cash[i] == cash[i-1]+1000;
}
}
}
for(int i=time-1;i>0;i--) {
if (per[i-1]>per[i]) {
cash[i-1] = cash[i]+1000;
}else if(per[i-1]==per[i]) {
cash[i-1] = cash[i];
}
}
int total=0;
for(int i=0;i<time;i++) {
total+=cash[i];
}
cout << total;
return 0;
}