QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#607899#3873. Towershysbzdkf0 1444ms73692kbC++141.2kb2024-10-03 16:58:062024-10-03 16:58:06

Judging History

This is the latest submission verdict.

  • [2024-10-03 16:58:06]
  • Judged
  • Verdict: 0
  • Time: 1444ms
  • Memory: 73692kb
  • [2024-10-03 16:58:06]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,hang[1000001],lon,ans[1000001],mix1,max1,miy1,may1;
struct node{
	int x,y;
}a[1000001];
struct edge{
	int num,l,r;
};
map<int,edge>h;
signed main(){
//	freopen("tower.in","r",stdin);
//	freopen("tower.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].x>>a[i].y;
		if(!mix1)
			mix1=a[i].x;
		else
			mix1=min(mix1,a[i].x);
		max1=max(max1,a[i].x);
		if(!miy1)
			miy1=a[i].y;
		else
			miy1=min(miy1,a[i].y);
		may1=max(may1,a[i].y);
		if(!h[a[i].y].num)
			hang[++lon]=a[i].y,h[a[i].y]={0,i,i};
		h[a[i].y].num++;
		if(a[i].x<a[h[a[i].y].l].x)
			h[a[i].y].l=i;
		if(a[i].x>a[h[a[i].y].r].x)
			h[a[i].y].r=i;
	}
//	if(n<=16){
//		
//	}
//	else{
		bool flag=1;
		for(int i=1;i<=lon;i++)
			if(h[hang[i]].num>3){
				flag=0;
				break;
			}
		if(flag){
			for(int i=1;i<=lon;i++){
				ans[h[hang[i]].l]=1;
				ans[h[hang[i]].r]=1;
			}			
		}
		else{
			if(max1-mix1>=2&&may1-miy1>=2){
				cout<<-1<<endl;
				return 0;;
			}
			for(int i=1;i<=n;i++)
				ans[i]=1;
		}
//	}
	for(int i=1;i<=n;i++)
		cout<<ans[i];
	cout<<endl;
	return 0;
}
/*
3
1 2
1 3
2 1
*/

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 0ms
memory: 3644kb

input:

2
869400 218695
664808 31410

output:

11

result:

ok 

Test #2:

score: 5
Accepted
time: 0ms
memory: 3628kb

input:

2
195447 154323
271823 133730

output:

11

result:

ok 

Test #3:

score: 5
Accepted
time: 0ms
memory: 3556kb

input:

3
751594 545975
951568 859051
621150 686048

output:

111

result:

ok 

Test #4:

score: 5
Accepted
time: 0ms
memory: 3632kb

input:

3
404592 259430
770816 43371
147329 582162

output:

111

result:

ok 

Test #5:

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

input:

3
401670 296316
401670 809250
401670 595959

output:

111

result:

wrong answer 

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Wrong Answer

Test #26:

score: 0
Wrong Answer
time: 38ms
memory: 5180kb

input:

92690
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 6...

output:

-1

result:

wrong answer 

Subtask #4:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 846ms
memory: 25132kb

input:

1000000
1 18543
4 40327
7 19084
8 44274
10 42366
12 22173
13 9862
15 44706
19 48070
21 13389
24 39273
26 18680
27 46858
28 46126
32 27753
34 28289
36 12220
38 39235
42 28505
45 47348
46 34220
48 47551
50 49156
54 8856
55 25515
56 21932
58 24482
59 20686
61 41381
66 30112
67 44504
70 24510
71 26418
7...

output:

-1

result:

wrong answer 

Subtask #5:

score: 0
Skipped

Dependency #2:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Wrong Answer

Test #85:

score: 0
Wrong Answer
time: 1444ms
memory: 73692kb

input:

1000000
1 602300
1 778881
2 397065
3 291452
3 678039
5 235300
6 499367
8 8597
10 327718
10 516489
12 416542
12 440048
13 284169
13 383581
13 642202
13 770858
14 378154
14 710033
15 905531
16 50155
17 142259
19 395613
19 500321
20 358934
21 461772
24 562953
24 995887
25 421244
27 900412
29 301006
31 ...

output:

-1

result:

wrong answer