QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747888#9574. StripsQF_love_younger_sisterWA 25ms3848kbC++231.5kb2024-11-14 18:36:592024-11-14 18:37:00

Judging History

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

  • [2024-11-14 18:37:00]
  • 评测
  • 测评结果:WA
  • 用时:25ms
  • 内存:3848kb
  • [2024-11-14 18:36:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int a[N],b[N];
struct shu{
	int zhi,bh;
}q[N];
int flag=1;
bool cmp(shu a,shu b){
	if(a.zhi==b.zhi && a.bh!=b.bh){
		flag=0;
	}
	return a.zhi<b.zhi;
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,m,k,w;
	int t;
	cin >> t;
	while(t--){
		flag=1;
		vector<int> da;
		cin >> n >> m >> k >> w;
		for(int i=1;i<=n;i++){
			cin >> q[i].zhi;
			q[i].bh=1;
		}
		for(int i=n+1;i<=n+m;i++){
			cin >> q[i].zhi;
			q[i].bh=2;
		}
		q[n+m+1].bh=2;
		q[n+m+1].zhi=w+1;
		sort(q+1,q+1+n+m+1,cmp);
		if(flag){
			int bws=0,aws=0,awm=0,bwm=0,fk=1;
			int flag1=1;
			for(int i=1;i<=n+m+1;i++){
				if(q[i].bh==2){
					bws=bwm;
					bwm=i;
					if(!(aws==0&&awm==0) && fk==0){
						int bl=q[bwm].zhi-q[bws].zhi-1;
						int al=q[awm].zhi-q[aws].zhi+1;
						int bian=(al+k-1)/k*k;
						if(bian>bl){
							flag1=0;
							break;
						}
						int tou=min(q[bwm].zhi-bian,q[aws].zhi);
						for(int i=0;i<(al+k-1)/k;i++){
							da.push_back(tou+k*i);
						}
					}
					fk=1;
				}
				if(q[i].bh==1){
					if(fk==1){
						fk=0;
						aws=i;
						awm=i;
					}
					else{
						awm++;
					}
				}
			}
			if(flag1){
				int len2=da.size();
				cout << len2 << "\n";
				for(int i=0;i<len2;i++){
					cout << da[i] << " ";
				}
				cout << "\n";
			}
			else cout << "-1" << "\n";
		}
		else{
			cout << "-1" << "\n";
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3756kb

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:

4
2 7 10 14 
-1
2
1 5 
-1

result:

ok ok 4 cases (4 test cases)

Test #2:

score: -100
Wrong Answer
time: 25ms
memory: 3848kb

input:

11000
3 8 2 53
32 3 33
35 19 38 20 1 30 10 6
7 10 1 42
3 14 4 36 28 40 22
17 20 12 41 27 7 1 19 13 9
6 6 13 78
55 76 53 32 54 58
62 45 21 4 7 61
8 7 3 68
9 26 54 31 22 3 38 65
34 16 58 47 52 29 53
5 8 4 33
33 5 30 6 15
27 12 9 28 19 2 13 10
6 1 2 48
8 12 48 1 41 31
40
7 6 7 61
20 19 30 52 49 17 40
3...

output:

2
3 32 
17
3 4 14 22 28 29 30 31 32 33 34 35 36 37 38 39 40 
3
32 48 66 
9
3 6 9 22 25 31 38 54 65 
3
5 15 30 
20
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 41 43 45 47 
4
17 30 37 49 
3
52 63 74 
1
27 
1
22 
1
62 
14
24 33 35 37 39 41 43 48 50 52 54 56 58 60 
2
4 31 
3
11 19 31 
3
3 16 33 
7
25 26 ...

result:

wrong answer Integer parameter [name=c] equals to 17, violates the range [-1, 7] (test case 2)