# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1045636 |
2024-08-06T06:39:46 Z |
ezzzay |
Skyline (IZhO11_skyline) |
C++14 |
|
0 ms |
440 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define pb push_back
const int N=3e5+5;
vector<int>ans;
int a[N];
signed main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int k=0;
for(int i=1;i<=n-2;i++){
int h=min({a[i],a[i+1],a[i+2]});
k+=h*7;
a[i]-=h;
a[i+1]-=h;
a[i+2]-=h;
}
for(int i=1;i<=n-1;i++){
int h=min(a[i],a[i+1]);
k+=h*5;
a[i]-=h;
a[i+1]-=h;
}
for(int i=1;i<=n;i++){
k+=a[i]*3;
}
cout<<k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
440 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |