[codeforces 1313C1] 스카이스크래퍼스(easy version)는 골짜기를 묻고 봉우리를 맞춘다.
1510 단어 codeforces
[codeforces 1313C1] 스카이스크래퍼스(easy version)는 골짜기를 묻고 봉우리를 맞춘다.
총목록 상세 정보https://blog.csdn.net/mrcrack/article/details/103564004
온라인 평가 주소https://codeforces.ml/contest/1313/problem/C1
Problem
Lang
Verdict
Time
Memory
C1 - Skyscrapers (easy version)
GNU C++11
Accepted
31 ms
0 KB
시합 때 이 문제 C1의 AC율이 B문제의 2-3배인 것을 발견하였는데, 기본적으로 다음과 같은 알고리즘은 성숙한 알고리즘이라고 볼 수 있다.
시합할 때도 과감하게 B문제를 놓고 C1문제의 코드를 시작한다.
골짜기를 물었더니 봉우리를 맞혔다.
샘플 수동 알고리즘은 다음과 같다.
Input1
5
1 2 3 2 1
Output1
1 2 3 2 1 3
Input2
3
10 6 8 6
10 6 6 10 , ,int
6 6 8 6
Output2
10 6 6 10
: ,
Also there mustn't be integers j and k such that jai
입력한 모든 데이터를 피크로 만들고 새 배열을 처리하며 그에 상응하는 합을 계산합니다. and the total number of floors in all skyscrapers is the maximum possible.가장 큰 합을 고르다.
AC 코드는 다음과 같습니다.
#include
#define maxn 1010
#define LL long long
LL tot,sum;
int a[maxn],m[maxn],ans[maxn];
int min(int a,int b){
return a=1;j--)a[j]=min(m[j],a[j+1]),sum+=a[j];//
for(j=i+1;j<=n;j++)a[j]=min(m[j],a[j-1]),sum+=a[j];//
if(tot
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Codeforces Round #715 Div. 2C The Sports Festival: 구간 DP전형구간 DP의 초전형. 이하, 0-indexed. 입력을 정렬하여 어디서나 시작하고 최적으로 좌우로 계속 유지하면 좋다는 것을 알 수 있습니다. {2000})$의 주문이 된다. 우선, 입력을 소트하여 n개의 요소를 $...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.