# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1006397 | devariaota | Bigger segments (IZhO19_segments) | C++17 | 0 ms | 344 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll dp[500005], pos[500005], pref[500005], a[500005];
int main()
{
ll n;
scanf("%lld", &n);
for(int i=1; i<=n; i++)
{
scanf("%lld", &a[i]);
pref[i]=pref[i-1]+a[i];
}
pref[n+1]=1e18;
for(int i=1; i<=n; i++)
{
dp[i]=dp[pos[i]]+1;
pos[i]=max(pos[i], pos[i-1]);
ll pt=lower_bound(pref+1, pref+n+1, 2*pref[i]-pref[pos[i]-1])-pref;
// printf("pos=%lld %lld %lld\n", pos[i], pt, dp[i]);
pos[pt]=i;
}
printf("%lld\n", 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... |