# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
299746 | dantoh000 | Bigger segments (IZhO19_segments) | C++14 | 1538 ms | 1592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, int> li;
ii dp[500005];
int n;
ll p[500005];
int main(){
scanf("%d",&n);
for (int i = 1; i <= n; i++){
scanf("%lld",&p[i]);
p[i]+=p[i-1];
dp[i] = {0,0};
for (int j = i-1; j >= 0; j--){
if (p[i]-p[j] >= p[j]-p[dp[j].se]){
dp[i] = max(dp[i],{dp[j].fi+1, j});
break;
}
}
}
printf("%d",dp[n].fi);
}
컴파일 시 표준 에러 (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... |