# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
416298 | Runtime_error_ | Money (IZhO17_money) | C++14 | 1363 ms | 58076 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>
using namespace std;
const int inf = 1e6+9;
int n,ans,a[inf];
set<int> s;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",a+i);
int pt = 1,cnt = 0;
while(pt <= n){
cnt++;
assert(cnt <= n);
int mn = inf,mx = 0,i,pre = 0;
for(i=pt;i<=n;i++){
if(a[i] < pre)
break;
mn = min(mn,a[i]);
mx = max(mx,a[i]);
pre = a[i];
if(s.empty() || *s.begin() >= mx || *s.rbegin() <= mn || *s.upper_bound(mn) >= mx)
continue;
break;
}
ans++;
for(int j=pt;j<i;j++)
s.insert(a[j]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |