QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#217386 | #6366. Message | Fy5Fengye | WA | 0ms | 3552kb | C++14 | 638b | 2023-10-16 20:23:38 | 2023-10-16 20:23:39 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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: ''