# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047414 | PagodePaiva | Real Mountains (CCO23_day1problem2) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define resp1 resp
#define int long long
using namespace std;
const int N = 1000010;
int res[N];
const int mod = 1e6+3;
int main(){
int n;
cin >> n;
vector <int> v;
int idxmax = 0;
int mxval = 0;
for(int i = 0;i < n;i++){
int x;
cin >> x;
mxval = max(mxval, x);
v.push_back(x);
if(x > v[idxmax]) idxmax = i;
}
int pref = 0;
for(int i = 0;i < idxmax;i++){
pref = max(pref, v[i]);
res[i] = pref;
}
pref = 0;
for(int i = n-1;i > idxmax;i--){
pref = max(pref, v[i]);