QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#751892 | #9574. Strips | whileone27 | WA | 0ms | 7732kb | C++14 | 1.1kb | 2024-11-15 21:12:24 | 2024-11-15 21:12:25 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define mk make_pair
const int N=5e6+5;
int T,n,m,w,K;
int ans[N],anss,a[N],b[N];
signed main(){
ios::sync_with_stdio(0);
cin>>T;
while(T--){
cin>>n>>m>>K>>w;
for(int i=1;i<=n;++i)cin>>a[i];
for(int j=1;j<=m;++j)cin>>b[j];
sort(a+1,a+n+1);
sort(b+1,b+m+1);
anss=0;
b[m+1]=w+1;
int j=1,op=0;
for(int i=1;i<=m+1;++i){
int ls=j;
while(a[j]<b[i]&&j<=n)++j;
int rs=j-1,mx=a[ls]-1;
if(rs<ls)continue;
int fl=anss;
for(int k=ls;k<=rs;++k)
if(mx<a[k])ans[++anss]=a[k],mx=a[k]+K-1;
if(mx>=b[i]){
cout<<mx<<"CNMCNM\n";
int mn=b[i]-K;
ans[anss]=mn;
// cout<<mn<<" "<<ans[1]<<' '<<fl<<' '<<b[i]<<" "<<b[i-1]<<"FSDJLK\n";
for(int k=anss-1;k>fl;--k)
if(ans[k]+K-1>=ans[k+1])ans[k]=ans[k+1]-K;
// cout<<ans[fl+1]<<' '<<anss<<' '<<fl+1<<" "<<a[ls]<<"CNMCNMCNM\n";
if(ans[fl+1]<b[i-1]){
op=1;
break;
}
}
}
if(op)cout<<-1<<'\n';
else{
cout<<anss<<'\n';
for(int i=1;i<=anss;++i)
cout<<ans[i]<<" ";
cout<<'\n';
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 7732kb
input:
4 5 2 3 16 7 11 2 9 14 13 5 3 2 4 11 6 10 2 1 11 2 1 2 6 1 5 3 2 1 2 6 1 5 2
output:
13CNMCNM 4 2 7 10 14 13CNMCNM -1 2 1 5 2CNMCNM 2 0 5
result:
wrong output format Expected integer, but "13CNMCNM" found (test case 1)