QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#111047 | #6564. Frequent Flier | OOBMABTRAMS# | WA | 2ms | 5544kb | C++17 | 892b | 2023-06-05 17:32:25 | 2023-06-05 17:32:26 |
Judging History
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'