# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
290763 | PKhing | Bigger segments (IZhO19_segments) | C++14 | 1575 ms | 2688 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define ii pair<ll,ll>
using namespace std;
ll tab[500005];
ll qs[500005];
ll dp[500005];
ll bf[500005];
int n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&tab[i]);
qs[i]=tab[i]+qs[i-1];
}
for(int i=1;i<=n;i++){
for(int j=0;j<i;j++){
if(qs[i]-qs[j]>=bf[j]){
if(dp[i]<dp[j]+1){
dp[i]=dp[j]+1;
bf[i] = qs[i]-qs[j];
}
else if(dp[i]==dp[j]+1){
bf[i]=min(bf[i],qs[i]-qs[j]);
}
}
}
//printf("%lld",dp[i]);
}
printf("%lld",dp[n]);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |