QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#111048 | #6564. Frequent Flier | OOBMABTRAMS# | WA | 19ms | 9076kb | C++17 | 886b | 2023-06-05 17:33:37 | 2023-06-05 17:33:42 |
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++){
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: 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'