제출 #475134

#제출 시각아이디문제언어결과실행 시간메모리
475134Mr_OK_ManPo (COCI21_po)C++17
0 / 70
1093 ms1868 KiB
#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 timeMemoryGrader output
Fetching results...