Submission #16609

#TimeUsernameProblemLanguageResultExecution timeMemory
16609eaststar달리는 게임 (kriii3_E)C++14
0 / 70
0 ms8892 KiB
#include <stdio.h> int a[1000010],chk[1000010]; long long ans,s,cnt; int main(){ int i,n; scanf("%d",&n); for(i=1;i<=n;++i)scanf("%d",a+i); for(;i;){ for(;a[i]<=0;--i); s=0; for(;i&&a[i]+s>0;s+=a[i--])chk[i]=1; } for(i=1;i<=n;++i){ for(cnt=1;i<=n&&chk[i];)ans+=a[i++]*(cnt++); } printf("%lld",ans); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...