# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475134 | Mr_OK_Man | Po (COCI21_po) | C++17 | 1093 ms | 1868 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;
int main()
{
// cout << "Hello world!" << endl;
ios_base::sync_with_stdio(0);
cin.tie(0);
long long n,c=0;
cin>>n;
vector<long long >a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
}
vector<long long>ok(n,0);
while(a!=ok)
{
long long s=-1,e=-1;
long long m=1e9+1;
for(int i=0;i<n;i++)
{
if(a[i]>0)
{
m=min(a[i],m);
if(s!=-1)
{
s=i;
}
e=i;
}
else
{
if(e!=-1&&s!=-1)break;
}
}
for(int i=s;i<=e;i++)
{
a[i]-=m;
}
c++;
}
cout<<c<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |