QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#111048#6564. Frequent FlierOOBMABTRAMS#WA 19ms9076kbC++17886b2023-06-05 17:33:372023-06-05 17:33:42

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-05 17:33:42]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:9076kb
  • [2023-06-05 17:33:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int mod=998244353;
typedef long long ll;
typedef long double ld;
int input=0;
const ll inf=2e18;
const int N=600013;
ll f[N];
ll use[N];
void solve(){
    ll v=0;
    int n,m,k;cin>>n>>m>>k;
    for(int i=1;i<=n;i++)cin>>f[i];
    int l=1;
    for(int i=1;i<=n+m-1;i++){
        l=max(l,i-m+1);
        if(i>m)v-=use[i-m];
        v+=(use[i]=min(f[i]-use[i],k-v));
        for(;l<=i;l++){
            ll nd=k-v;
            if(f[l]-use[l]<nd)v+=f[l]-use[l],use[l]=f[l];
            else use[l]+=nd,k=v;
            if(k==v)break;
        }
    }
    v=0;
    for(int i=1;i<=n;i++)v+=use[i];
    cout<<v<<'\n';
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cout<<fixed<<setprecision(10);
    int T;
    if(input)cin>>T;else T=1;
    for(int tc=1;tc<=T;tc++)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 5532kb

input:

8 3 2
3
1
4
1
5
9
2
6

output:

8

result:

ok single line: '8'

Test #2:

score: -100
Wrong Answer
time: 19ms
memory: 9076kb

input:

200000 2467 999931035
182548858
69876218
33328350
919486767
739850600
948199964
392292320
39077742
366752074
917496841
246661698
37219034
56677740
188278971
965701828
28059790
13200243
825730775
542597589
320715170
939054378
470563899
914247467
990100491
290827128
903662394
611104879
18631185
412134...

output:

79022712233754

result:

wrong answer 1st lines differ - expected: '82994275905', found: '79022712233754'