QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#111047#6564. Frequent FlierOOBMABTRAMS#WA 2ms5544kbC++17892b2023-06-05 17:32:252023-06-05 17:32:26

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:32:26]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5544kb
  • [2023-06-05 17:32:25]
  • 提交

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<=m;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();
}

详细

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 5544kb

input:

8 3 2
3
1
4
1
5
9
2
6

output:

7

result:

wrong answer 1st lines differ - expected: '8', found: '7'