| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 370470 | daniel920712 | Bigger segments (IZhO19_segments) | C++14 | 1567 ms | 3292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
long long all[500005];
pair < long long ,long long > DP[500005];
long long sum[500005]={0},N;
int main()
{
long long i,j,k,ans=0;
scanf("%lld",&N);
for(i=1;i<=N;i++)
{
scanf("%lld",&all[i]);
sum[i]=all[i]+sum[i-1];
}
DP[0]=make_pair(0,0);
for(i=1;i<=N;i++)
{
DP[i]=make_pair(0,0);
for(j=0;j<i;j++)
{
if(sum[i]-sum[j]>=DP[j].second)
{
if(DP[j].first+1>DP[i].first) DP[i]=make_pair(DP[j].first+1,sum[i]-sum[j]);
else if(DP[j].first+1==DP[i].first) DP[i]=make_pair(DP[j].first+1,min(DP[i].second,sum[i]-sum[j]));
}
}
}
printf("%lld\n",DP[N].first);
return 0;
}
컴파일 시 표준 에러 (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... | ||||
