Submission #15249

#TimeUsernameProblemLanguageResultExecution timeMemory
15249gs13068달리는 게임 (kriii3_E)C++98
0 / 70
2 ms1116 KiB
#include<cstdio> #include<algorithm> long long a[1111]; long long s[1111]; long long ss[1111]; long long d[1111]; int main() { int i,j,n; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%lld",&a[i]); for(i=n;i>=0;i--) { s[i]=s[i+1]+a[i]; ss[i]=ss[i+1]+s[i+1]; for(j=i+1;j<=n;j++)d[i]=std::max(d[i],d[j]+ss[i]-ss[j]-s[j+1]*(j-i)); } printf("%lld\n",d[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...