ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#208339 | #3774. Circular Platform Clutter | mygr | 100 | 942ms | 16824kb | C++ | 679b | 2024-08-02 10:43:01 | 2024-08-02 12:47:36 |
answer
#include<bits/stdc++.h>
#define int long long
#define db double
using namespace std;
const int Max=1e6+5;
int a[Max],sum[Max];
int n,m,k;
int ans=0;
int l[105];
int calc(int p,int pos)
{
return sum[p-1]+k*((int)ceil((db)(pos-p+1)/m));
}
signed main()
{
//freopen("A.in","r",stdin);
//freopen("A.out","w",stdout);
scanf("%lld%lld%lld",&n,&m,&k);
for(int i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
sum[i]=sum[i-1]+a[i];
}
for(int i=1;i<=n;i++)
{
int pos=i%m;
if(l[pos]==0 or calc(l[pos],i)>=calc(i,i))
l[pos]=i;
for(int j=0;j<m;j++)
{
if(l[j]==0)continue;
ans=max(ans,sum[i]-calc(l[j],i));
}
}
printf("%lld",ans);
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1228kb
input:
2000 3 16685558 -289282588 -61747468 -657707881 -34145392 -537924930 -406398379 -542751658 -75231580...
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 10
Accepted
time: 0ms
memory: 1232kb
input:
2000 9 54576364 255242838 -740596945 -246472080 950729683 -533760302 935128112 511618036 -775471790 ...
output:
329933931328
result:
ok 1 number(s): "329933931328"
Test #3:
score: 10
Accepted
time: 0ms
memory: 1228kb
input:
2000 9 73094302 512084424 67433847 974023247 550398283 943786443 -472874397 138837755 -744203670 539...
output:
332791924952
result:
ok 1 number(s): "332791924952"
Test #4:
score: 10
Accepted
time: 155ms
memory: 16820kb
input:
1000000 3 0 133466399 -867775767 963834867 775948067 -832740810 -713930238 -308186786 556371611 2949...
output:
647512117689
result:
ok 1 number(s): "647512117689"
Test #5:
score: 10
Accepted
time: 217ms
memory: 16824kb
input:
1000000 10 0 664925048 -566073238 877788649 -841053552 -308215965 -412748922 -840978942 -932597488 -...
output:
946593412159
result:
ok 1 number(s): "946593412159"
Test #6:
score: 10
Accepted
time: 117ms
memory: 16816kb
input:
1000000 1 383781667 797002344 -71828458 -547854034 543934687 917387704 832016545 -978766494 78233955...
output:
11338880406
result:
ok 1 number(s): "11338880406"
Test #7:
score: 10
Accepted
time: 16ms
memory: 2756kb
input:
100000 6 986672506 539233196 995762687 47061599 -854879180 810700777 -663371439 989492494 986856326 ...
output:
13786459060670
result:
ok 1 number(s): "13786459060670"
Test #8:
score: 10
Accepted
time: 18ms
memory: 2756kb
input:
100000 9 964197836 970180324 -694572429 985191372 -727965595 526258804 -617811687 -612003824 5067943...
output:
18656797316158
result:
ok 1 number(s): "18656797316158"
Test #9:
score: 10
Accepted
time: 208ms
memory: 16820kb
input:
1000000 10 944196936 -998994854 973754696 975675616 992984745 116889413 -987876256 917812370 -892363...
output:
196532701874927
result:
ok 1 number(s): "196532701874927"
Test #10:
score: 10
Accepted
time: 211ms
memory: 16816kb
input:
1000000 9 813298367 888006085 185751739 -970868688 -793265934 606885815 970133239 888746315 29012399...
output:
181821174468687
result:
ok 1 number(s): "181821174468687"