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>
using namespace std;
#define forn(i,n) for (int i=0; i<n; ++i)
void solve() {
cout<<"NO\n";
return;
int n; cin>>n;
vector<int> a(n); forn(i,n) cin>>a[i];
int ans=0;
vector<int> v={0};
for (int i=1; i<n; ++i) {
if (a[i]>=v.back()) {
for (int j=v.back()+1;j<=a[i];++j) v.push_back(j);
} else {
for (int j=v.back()-1;j>=a[i];--j) v.push_back(j);
}
}
int l=0, r=v.size()-1;
while (v[l+1]==v[r-1]) ++l, --r;
cout<<ans;
}
int32_t main() {
solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |