QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217386#6366. MessageFy5FengyeWA 0ms3552kbC++14638b2023-10-16 20:23:382023-10-16 20:23:39

Judging History

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

  • [2023-10-16 20:23:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2023-10-16 20:23:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
string s,t;
#define int long long
int n,m,w[400005];
int qzh[400005];
inline void solve2()
{
    if(n<m) {puts("-1"); return ;}
    memset(qzh,0,sizeof(qzh));
    for(int i=1;i<=n;++i) qzh[i]=qzh[i-1]+w[i];
    int ans=qzh[m]-qzh[0];
    for(int i=m;i<=n;++i) ans=max(ans,qzh[i]-qzh[i-m]);
    cout<<qzh[n]-ans<<endl;
}
inline void solve()
{
    cin>>n>>m>>s>>t;
    for(int i=1;i<=n;++i) cin>>w[i];
    solve2();
}
signed main()
{
    // freopen("letter.in","r",stdin);
    // freopen("letter.out","w",stdout);
    int T; cin>>T; while(T--) solve();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

ababccb
abc
7 2 2 4 3 2 1

output:


result:

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