# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
761558 | KN200711 | 스카이라인 (IZhO11_skyline) | C++14 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# define ll long long
# define fi first
# define se second
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> arr(N);
for(int i=0;i<N;i++) scanf("%d", &arr[i]);
bool ls = 1;
int ans = 0;
while(ls) {
ls = 0;
for(int c=0;c<N;c++) {
if(arr[c] == 0) continue;
ls = 1;
int mn = 1e9, cnt = 0;
for(int d=c;d<N && arr[d];d++) {
cnt++;
mn = min(mn, arr[d]);
}
for(int d=c;d<N && arr[d];d++) {
arr[d] -= mn;
}
ans += (2 * cnt + 1) * mn;
break;
}
}
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |