QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#607852#3873. Towerspanyifan202112 927ms152692kbC++141.2kb2024-10-03 16:44:352024-10-03 16:44:38

Judging History

This is the latest submission verdict.

  • [2024-10-03 16:44:38]
  • Judged
  • Verdict: 12
  • Time: 927ms
  • Memory: 152692kb
  • [2024-10-03 16:44:35]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
int n;
int ex[1000005],ey[1000005];
vector<int> col[1000005],t;
int l[1000005],r[1000005];
set<int> row[1000005];
bool ans[1000005];
queue<int> q;
void add(int x){
	ans[x]=1;
	row[ex[x]].insert(ey[x]);
	if(row[ex[x]].size()>2) 
	q.push(ex[x]);
}
void del(int x){
	ans[x]=0;
	row[ex[x]].erase(ey[x]);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>ex[i]>>ey[i];
		col[ey[i]].push_back(i);
	}
	for(int i=1;i<=1000000;i++){
		if(!col[i].size()) continue;
		sort(col[i].begin(),col[i].end());
		l[i]=0;
		r[i]=col[i].size()-1;
		add(col[i][l[i]]);
		if(l[i]!=r[i])
		add(col[i][r[i]]);
	}
	while(q.size()){
		int x=q.front();
		q.pop();
		if(row[x].size()<=2) continue;
		int ly=*row[x].begin(),ry=*--row[x].end();
		t.clear();
		for(int y:row[x]) 
			if(y!=ly&&y!=ry) 
				t.push_back(y);
		for(int y:t){
			if(y==ly||y==ry) continue;
			if(l[y]>r[y]) continue;
			if(l[y]==r[y]) del(col[y][l[y]++]);
			else if(x==ex[col[y][l[y]]]){
				del(col[y][l[y]++]);
				if(l[y]<r[y]) add(col[y][l[y]]);
			}
			else{
				del(col[y][r[y]--]);
				if(l[y]<r[y]) add(col[y][r[y]]);
			}
		}
	}
	for(int i=1;i<=n;i++) 
	cout<<ans[i];
	return 0;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 7ms
memory: 77324kb

input:

2
869400 218695
664808 31410

output:

11

result:

ok 

Test #2:

score: 5
Accepted
time: 7ms
memory: 77384kb

input:

2
195447 154323
271823 133730

output:

11

result:

ok 

Test #3:

score: 5
Accepted
time: 16ms
memory: 84584kb

input:

3
751594 545975
951568 859051
621150 686048

output:

111

result:

ok 

Test #4:

score: 5
Accepted
time: 11ms
memory: 82448kb

input:

3
404592 259430
770816 43371
147329 582162

output:

111

result:

ok 

Test #5:

score: 5
Accepted
time: 11ms
memory: 75260kb

input:

3
401670 296316
401670 809250
401670 595959

output:

110

result:

ok 

Test #6:

score: 5
Accepted
time: 7ms
memory: 77328kb

input:

3
657802 927690
657802 872623
657802 83083

output:

101

result:

ok 

Test #7:

score: 5
Accepted
time: 11ms
memory: 75100kb

input:

3
759291 185618
759291 386687
759291 100713

output:

011

result:

ok 

Test #8:

score: 5
Accepted
time: 8ms
memory: 74984kb

input:

3
997737 106763
684497 106763
412296 106763

output:

101

result:

ok 

Test #9:

score: 5
Accepted
time: 12ms
memory: 77608kb

input:

3
305388 642835
538743 642835
608034 642835

output:

101

result:

ok 

Test #10:

score: 5
Accepted
time: 16ms
memory: 79396kb

input:

3
420692 202248
784725 202248
931773 202248

output:

101

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #11:

score: 11
Accepted
time: 11ms
memory: 79604kb

input:

16
296455 404592
582162 770816
807435 536085
259430 536085
112538 770816
610915 369095
582162 369095
94860 147329
112538 147329
296455 61932
259430 147329
807435 369095
610915 404592
807435 309191
807435 61932
94860 770816

output:

1111011101101011

result:

ok 

Test #12:

score: 0
Wrong Answer
time: 12ms
memory: 79992kb

input:

16
561476 595959
58474 595959
58474 664431
105001 143086
809250 250085
58474 250085
789588 281386
350332 161786
789588 250085
561476 281386
296316 401670
296316 250085
350332 595959
296316 161786
350332 281386
58474 281386

output:

1011101110101101

result:

wrong answer 

Subtask #3:

score: 7
Accepted

Test #26:

score: 7
Accepted
time: 56ms
memory: 81452kb

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:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #27:

score: 7
Accepted
time: 57ms
memory: 84360kb

input:

111890
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #28:

score: 7
Accepted
time: 111ms
memory: 85804kb

input:

339624
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
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2...

output:

100000000000000000000000000000000000000000000000000010100000000000000000000000000000000000000000000000001000100000000000000000000000000000000000000000000000100000100000000000000000000000000000000000000000000010000000100000000000000000000000000000000000000000001000000000100000000000000000000000000000...

result:

ok 

Test #29:

score: 7
Accepted
time: 215ms
memory: 90480kb

input:

668528
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #30:

score: 7
Accepted
time: 48ms
memory: 84184kb

input:

121950
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010...

result:

ok 

Test #31:

score: 7
Accepted
time: 18ms
memory: 80348kb

input:

24628
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:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000000000000000000000000000000...

result:

ok 

Test #32:

score: 7
Accepted
time: 250ms
memory: 89068kb

input:

627882
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #33:

score: 7
Accepted
time: 154ms
memory: 87972kb

input:

418363
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #34:

score: 7
Accepted
time: 403ms
memory: 91932kb

input:

934738
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #35:

score: 7
Accepted
time: 310ms
memory: 89216kb

input:

787195
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #36:

score: 7
Accepted
time: 341ms
memory: 90568kb

input:

1000000
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...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Test #37:

score: 7
Accepted
time: 320ms
memory: 90504kb

input:

998001
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 ...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 

Subtask #4:

score: 0
Wrong Answer

Test #38:

score: 0
Wrong Answer
time: 602ms
memory: 98944kb

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:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

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: 19
Accepted
time: 926ms
memory: 152608kb

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:

111111111111100111111111111111101111110111101101111111111111111111111111111111111101111110111111111111110011111011111111111111111111111001111011111001100111101111111111000111111111111111000111111111101111111011111111111111110111111111111111111101111111110111111111011111111111111111111111110110011111...

result:

ok 

Test #86:

score: 19
Accepted
time: 927ms
memory: 152692kb

input:

1000000
2 58226
2 455245
2 648131
3 483466
4 524911
5 587684
5 697266
6 997653
7 683510
9 770652
10 265650
10 324702
10 391848
10 401829
11 540731
12 827491
14 955978
15 122678
15 331809
16 127204
17 287507
18 116880
18 855160
19 608488
20 395997
21 149717
21 216614
24 24047
24 605282
26 959819
27 6...

output:

101111111110011111111111111111111111111111111111111111111111111111100111111111001111100110111110111111011101110011111111000110111111111111111011111111111111111111111111111111110111111110011111111111110111111111111111111000111101111101111111011111111110011111001101111011111000110110111111111111101111...

result:

ok 

Test #87:

score: 19
Accepted
time: 914ms
memory: 152660kb

input:

1000000
5 949597
7 311192
7 694097
8 285857
11 104415
12 990158
13 309094
13 419142
13 756795
13 814729
14 478920
15 530506
15 571944
18 570444
20 298039
24 398050
31 309151
32 372683
33 232666
36 956153
38 60556
40 185040
42 733818
45 153225
46 377778
47 55838
51 92225
52 934980
53 552404
57 242988...

output:

111111100111111111111111111111111111111011111110111111111111111101111111111111111110011111111111111111111111111111110111111111111111111011101111111001110011011111111111111111111111111111111111111111111110110111111111011111111111111110001111111111101111001111111111111111111101111111011111101110111101...

result:

ok 

Test #88:

score: 0
Wrong Answer
time: 926ms
memory: 107836kb

input:

1000000
650301 76103
650301 322034
650301 690214
650301 141011
650301 593402
650301 693066
650301 257404
650301 125397
650301 230197
650301 136891
650301 43005
948323 628713
948323 264598
948323 602730
948323 943592
948323 763299
948323 185927
948323 351367
948323 346479
948323 929518
948323 375347
...

output:

000001000010000010000000011000000010101010000000101000010010000001000000011000000000101000000001000010010000000001000000001000100000000100101100000001100000000100000100001000010000000001000000001000001001000000100100000100000000011001000000000000001100000000011000000011001010000001010000001000000001...

result:

wrong answer