QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#609975#3873. Towersxzf_20090629 213ms78828kbC++141.9kb2024-10-04 14:37:082024-10-04 14:37:10

Judging History

This is the latest submission verdict.

  • [2024-10-04 14:37:10]
  • Judged
  • Verdict: 29
  • Time: 213ms
  • Memory: 78828kb
  • [2024-10-04 14:37:08]
  • Submitted

answer

#include <bits/stdc++.h>
#define LL long long
using namespace std;
vector<pair<int,int> > poi[1000005];
int col[1000005][2],cnt[1000005];
pair<int,bool> use[1000005][2];
bool ans[1000005];
bool clr(int pos,int x){
	if(cnt[pos]<=1) return 1;
	if(use[pos][0].first<=x&&use[pos][1].first>=x) return 0;
	int num=use[pos][0].first<=x?1:0;
	int p=use[pos][num].first,sta=use[pos][num].second;
	use[pos][num]={0,0};
	cnt[pos]--;
	if(cnt[pos]==1&&num==0) swap(use[pos][0],use[pos][1]);
	if(sta==0){
		while(1){
			col[p][0]++;
			if(col[p][0]>=col[p][1]) return 1;
			int tmp=poi[p][col[p][0]].first;
			if(clr(tmp,p)){
				use[tmp][cnt[tmp]]={p,0};
				cnt[tmp]++;
				if(cnt[tmp]==2&&use[tmp][0]>use[tmp][1]) swap(use[tmp][0],use[tmp][1]);
				return 1;
			}
		}
	}
	else{
		while(1){
			col[p][1]--;
			if(col[p][0]>=col[p][1]) return 1;
			int tmp=poi[p][col[p][1]].first;
			if(clr(tmp,p)){
				use[tmp][cnt[tmp]]={p,1};
				cnt[tmp]++;
				if(cnt[tmp]==2&&use[tmp][0]>use[tmp][1]) swap(use[tmp][0],use[tmp][1]);
				return 1;
			}
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	int xx,yy;
	for(int i=1;i<=n;i++){
		int x,y;
		cin>>x>>y;
		poi[x].push_back({y,i});
		if(i==29) xx=x,yy=y;
	}
	for(int i=1;i<=1000000;i++){
		if(poi[i].empty()) continue;
		sort(poi[i].begin(),poi[i].end());
		col[i][0]=0;
		col[i][1]=poi[i].size()-1;
		int tmp=poi[i].front().first;
		clr(tmp,i);
		use[tmp][cnt[tmp]]={i,0};
		cnt[tmp]++;
		if(poi[i].size()!=1){
			int tmp=poi[i].back().first;
			clr(tmp,i);
			use[tmp][cnt[tmp]]={i,1};
			cnt[tmp]++;
		}
	}
	for(int i=1;i<=1000000;i++) assert(cnt[i]<=2);
	for(int i=1;i<=1000000;i++){
		if(poi[i].empty()) continue;
		if(col[i][0]<=col[i][1]) ans[poi[i][col[i][0]].second]=ans[poi[i][col[i][1]].second]=1;
	}
	for(int i=1;i<=n;i++) cout<<ans[i];
	cout<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 10ms
memory: 33204kb

input:

2
869400 218695
664808 31410

output:

11

result:

ok 

Test #2:

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

input:

2
195447 154323
271823 133730

output:

11

result:

ok 

Test #3:

score: 5
Accepted
time: 14ms
memory: 37684kb

input:

3
751594 545975
951568 859051
621150 686048

output:

111

result:

ok 

Test #4:

score: 5
Accepted
time: 4ms
memory: 41004kb

input:

3
404592 259430
770816 43371
147329 582162

output:

111

result:

ok 

Test #5:

score: 5
Accepted
time: 6ms
memory: 35068kb

input:

3
401670 296316
401670 809250
401670 595959

output:

110

result:

ok 

Test #6:

score: 5
Accepted
time: 6ms
memory: 35040kb

input:

3
657802 927690
657802 872623
657802 83083

output:

101

result:

ok 

Test #7:

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

input:

3
759291 185618
759291 386687
759291 100713

output:

011

result:

ok 

Test #8:

score: 5
Accepted
time: 3ms
memory: 35192kb

input:

3
997737 106763
684497 106763
412296 106763

output:

101

result:

ok 

Test #9:

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

input:

3
305388 642835
538743 642835
608034 642835

output:

101

result:

ok 

Test #10:

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

input:

3
420692 202248
784725 202248
931773 202248

output:

101

result:

ok 

Subtask #2:

score: 11
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 11
Accepted
time: 9ms
memory: 48396kb

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: 11
Accepted
time: 11ms
memory: 43572kb

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:

1011111101101100

result:

ok 

Test #13:

score: 11
Accepted
time: 10ms
memory: 46508kb

input:

16
316904 170612
433799 125553
316904 125553
859728 341680
433799 32398
872623 388831
859728 83083
872623 83083
584763 388831
148042 861814
316904 861814
927690 861814
148042 83083
148042 32398
584763 657802
905375 388831

output:

1111101111010111

result:

ok 

Test #14:

score: 11
Accepted
time: 7ms
memory: 41184kb

input:

16
386687 759291
995919 169567
788489 197826
185618 713079
198743 100713
995919 372561
916765 169567
185618 763504
386687 169567
832084 763504
832084 759291
386687 292594
185618 197826
386687 197826
832084 197826
916765 759291

output:

1100110111001011

result:

ok 

Test #15:

score: 11
Accepted
time: 8ms
memory: 44220kb

input:

16
716236 20497
587980 648488
587980 642779
412708 997737
369271 642779
106763 71182
412708 642779
173374 869560
684497 648488
587980 945118
106763 648488
716236 412296
587980 71182
412708 869560
369271 869560
412708 412296

output:

1001110111111011

result:

ok 

Test #16:

score: 11
Accepted
time: 7ms
memory: 42816kb

input:

16
642835 173421
512014 309394
610395 518804
538743 305388
493101 608034
610395 85927
214511 309394
512014 173421
214511 608034
493101 85927
512014 85927
538743 309394
538743 608034
512014 518804
610395 309394
214511 518804

output:

1011011111001100

result:

ok 

Test #17:

score: 11
Accepted
time: 10ms
memory: 46780kb

input:

16
327159 848430
202248 689260
248917 848430
860732 109812
810547 931773
248917 551698
248917 109812
327159 109812
202248 420692
784725 848430
810547 109812
860732 551698
860732 848430
784725 109812
810547 689260
810547 551698

output:

0111101010001001

result:

ok 

Test #18:

score: 11
Accepted
time: 3ms
memory: 44768kb

input:

16
929868 357006
544399 533307
65980 485996
679846 756501
679846 533307
679846 712386
888311 756501
679846 357006
569069 357006
679846 326645
65980 712386
569069 756501
544399 357006
929868 712386
929868 326645
888311 357006

output:

0110101001111111

result:

ok 

Test #19:

score: 11
Accepted
time: 4ms
memory: 40280kb

input:

16
819172 856879
310900 856879
110339 25925
110339 712188
110339 856879
193758 568642
110339 518110
334829 712188
819172 25925
334829 518110
962527 856879
962527 712188
819172 568642
193758 712188
819172 518110
193758 856879

output:

0010110011111100

result:

ok 

Test #20:

score: 11
Accepted
time: 7ms
memory: 41040kb

input:

16
788180 40074
788180 353457
642341 40074
919317 353457
642341 341228
139346 808233
788180 889183
919317 40074
87340 808233
788180 341228
139346 32374
919317 808233
919317 341228
753883 32374
87340 32374
919317 32374

output:

1010101010010011

result:

ok 

Test #21:

score: 11
Accepted
time: 4ms
memory: 40596kb

input:

16
965515 596717
798876 887533
800289 573487
798876 325675
798876 596717
965515 760793
800289 887533
800289 760793
798876 573487
965515 887533
681117 596717
965515 573487
48193 325675
965515 325675
798876 760793
681117 325675

output:

0110000111101100

result:

ok 

Test #22:

score: 11
Accepted
time: 7ms
memory: 43356kb

input:

16
149212 434288
500896 813986
149212 874409
149212 399513
820463 813986
468173 874409
500781 461669
820463 461669
149212 461669
820463 434288
468173 399513
500896 434288
468173 461669
820463 874409
500896 874409
149212 813986

output:

0111001001111100

result:

ok 

Test #23:

score: 11
Accepted
time: 7ms
memory: 43064kb

input:

16
699564 798118
908277 529562
699564 529562
522034 155145
699564 882739
699564 676309
522034 882739
674634 882739
908277 882739
908277 155145
674634 529562
269930 529562
674634 676309
269930 882739
269930 798118
269930 676309

output:

1011000011011100

result:

ok 

Test #24:

score: 11
Accepted
time: 10ms
memory: 41148kb

input:

16
340926 122845
837654 479692
340926 665346
933317 122845
355500 820776
914026 479692
933317 665346
837654 665346
914026 665346
933317 900289
837654 820776
914026 900289
837654 900289
340926 900289
340926 820776
933317 479692

output:

1101110011100100

result:

ok 

Test #25:

score: 11
Accepted
time: 4ms
memory: 42912kb

input:

16
778218 780821
275288 780821
624040 780821
639375 399191
639375 88034
624040 775928
639375 655766
778218 775928
478222 399191
639375 780821
478222 775928
275288 655766
275288 88034
624040 655766
478222 88034
778218 399191

output:

1100111010101101

result:

ok 

Subtask #3:

score: 7
Accepted

Test #26:

score: 7
Accepted
time: 22ms
memory: 33812kb

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: 21ms
memory: 33612kb

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: 48ms
memory: 34420kb

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: 78ms
memory: 40564kb

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: 25ms
memory: 30772kb

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: 12ms
memory: 29664kb

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: 74ms
memory: 39484kb

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: 57ms
memory: 38616kb

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: 108ms
memory: 41312kb

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: 93ms
memory: 40744kb

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: 119ms
memory: 39800kb

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: 116ms
memory: 40692kb

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: 6
Accepted

Test #38:

score: 6
Accepted
time: 169ms
memory: 62612kb

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:

ok 

Test #39:

score: 6
Accepted
time: 165ms
memory: 62464kb

input:

1000000
2 21155
4 41232
6 20287
7 46837
9 38631
11 6901
15 43358
16 10142
19 28642
20 33035
21 27599
24 20951
27 12983
30 11366
31 20539
32 10621
34 30734
37 6043
41 5841
43 8213
46 8479
47 12328
49 5893
50 22485
51 39760
52 8737
54 43535
56 24827
57 15847
59 8402
61 23013
65 17937
66 18072
69 36863...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111111111111111111111111111111111111111111111111111111111111111111110...

result:

ok 

Test #40:

score: 6
Accepted
time: 160ms
memory: 62436kb

input:

1000000
1 44308
3 27877
4 48227
6 27660
8 26210
9 43909
10 11659
11 34110
13 39632
15 7390
17 40561
20 7928
24 24624
25 9113
27 28937
29 23508
30 41645
32 38110
34 10958
36 37937
37 46339
38 41683
40 7125
41 11569
42 9531
44 29591
45 45867
46 48643
49 7654
50 33740
52 26995
55 13345
57 22001
59 1247...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #41:

score: 6
Accepted
time: 179ms
memory: 62388kb

input:

1000000
2 31149
4 25209
7 47632
9 13365
10 23457
12 38193
14 6534
15 33175
16 12181
19 26329
21 7294
24 25786
26 39155
27 12081
29 31350
33 16989
36 34867
38 31751
39 38661
41 17345
44 24470
47 41098
48 41797
51 27139
53 40756
54 15934
59 28395
63 46853
64 46994
66 14330
67 46212
69 23352
70 8115
72...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #42:

score: 6
Accepted
time: 184ms
memory: 62344kb

input:

1000000
1 38450
2 25296
5 6604
7 5068
8 44733
10 49030
11 48217
12 11533
14 7208
15 37097
16 13793
21 41955
23 45683
25 31223
27 27252
28 26319
30 9053
35 41698
36 18276
41 20100
42 32537
44 41677
46 37754
48 28572
50 44106
52 43957
56 21750
57 21732
61 12737
64 45597
66 42872
67 9711
68 25897
69 41...

output:

111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111...

result:

ok 

Test #43:

score: 6
Accepted
time: 213ms
memory: 78828kb

input:

1000000
2 880200
3 405629
4 505753
8 827569
9 249542
15 230517
19 801043
21 393006
23 167265
25 246534
28 302737
32 665950
33 146821
35 765079
36 349562
37 691530
39 446351
40 692089
42 997833
43 688018
44 185484
46 236680
48 414992
50 677116
52 922426
55 930670
57 429844
58 978728
60 671339
62 2508...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #44:

score: 6
Accepted
time: 204ms
memory: 78812kb

input:

1000000
1 905626
2 338678
5 553579
7 552200
8 784328
10 112106
11 928788
12 719285
14 737963
16 204427
17 313941
19 504387
21 61669
22 430904
24 75978
25 248640
26 317625
29 619690
31 193568
32 966216
34 851031
36 964644
37 111735
38 50038
39 436056
41 165749
42 733480
44 45671
46 501053
47 394829
5...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #45:

score: 6
Accepted
time: 195ms
memory: 78756kb

input:

1000000
1 524431
7 627962
11 814078
12 347856
14 929279
16 407341
19 77713
22 938040
25 611644
26 421438
27 39608
29 875594
31 950490
33 938280
35 569458
36 399569
37 565433
39 200899
41 512932
42 892335
45 785082
49 138075
52 556802
55 964794
56 23280
59 765396
63 56095
65 334489
67 116493
68 64798...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #46:

score: 6
Accepted
time: 200ms
memory: 78740kb

input:

1000000
2 793441
5 57521
6 977344
8 152182
9 474068
10 56149
12 388264
15 295964
16 404775
18 333353
19 544761
21 208229
22 409823
26 71607
27 49633
30 748788
32 202839
35 362645
37 896518
38 500521
40 561975
41 682139
42 328620
44 733819
45 687203
47 184074
50 496029
52 831999
53 302832
54 228451
5...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #47:

score: 6
Accepted
time: 208ms
memory: 78760kb

input:

1000000
1 895838
2 325421
3 954723
4 164307
6 340013
7 825549
10 3829
14 523251
15 52480
17 752743
19 256730
21 743287
24 342268
25 348119
27 164916
28 961505
31 446402
33 903443
37 867901
39 765398
40 319469
41 495869
43 425064
45 442601
48 826731
51 870551
53 419326
54 456719
57 200828
59 642520
6...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Subtask #5:

score: 0
Runtime Error

Dependency #2:

100%
Accepted

Test #48:

score: 31
Accepted
time: 12ms
memory: 54180kb

input:

5000
630 834940
1078 467873
1422 66913
1625 637429
1858 7094
2604 14606
2856 736849
3081 499898
3119 554225
3576 425440
4849 908007
4853 104538
5110 977236
5143 964159
5747 640988
6165 361056
6365 647136
6927 363570
7593 417679
7633 166611
7868 239524
7922 119686
8093 769337
8323 289956
8562 213370
...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #49:

score: 31
Accepted
time: 4ms
memory: 54628kb

input:

5000
206 486676
260 940061
332 373083
417 29815
1123 924826
1271 128160
1361 962093
1678 199894
2006 703883
2178 328224
2298 567105
2299 392376
2391 567115
2506 878188
2959 121221
3121 792812
3293 658936
3303 416738
3526 319765
3532 385020
3588 867772
3744 5609
3766 726252
3986 312153
4412 248563
44...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 

Test #50:

score: 31
Accepted
time: 12ms
memory: 54048kb

input:

5000
56836 502298
22747 398101
22747 668280
22747 91147
156689 608116
156689 178657
156689 874003
199075 534371
199075 485132
670696 485192
670696 512351
670696 675493
670696 991173
479397 663643
479397 295839
479397 249249
479397 954296
138744 878381
138744 437755
138744 614568
138744 848568
138744...

output:

001110111100001010101000000101100010010110010100001101011101001101010001001100100101010001010000110000001001000011001101100100101000101000101100010000001011101000100010000100000001100011000101101011001000000100101100000010000100001000100100100110010010111100010110010110001000111000100000100101001000...

result:

ok 

Test #51:

score: 31
Accepted
time: 16ms
memory: 53980kb

input:

5000
742860 720238
386460 612538
386460 535326
386460 561848
386460 924326
386460 173230
918855 128227
918855 416611
918855 463819
918855 122929
443292 157965
443292 739555
443292 714469
443292 918662
443292 252656
443292 579149
443292 303928
443292 360194
443292 14142
395993 221877
395993 942282
39...

output:

001100001101001000010000000001010001010000110011001000100111100011100000110011010010010000101001000011001100100111000000011100101000110100010111000001110000100000100110101001011010011000011100011000000000111110011000100000010000000110010000000000111010011000000001001010100001001100000000000101001000...

result:

ok 

Test #52:

score: 31
Accepted
time: 20ms
memory: 54096kb

input:

5000
830117 814341
830117 133693
830117 504200
830117 951215
726445 41624
726445 292122
726445 211652
726445 325540
726445 310700
726445 284698
761749 446024
761749 232746
761749 16009
761749 323190
761749 259266
761749 652784
456689 538764
456689 620826
456689 340657
39111 939886
39111 410769
26797...

output:

010100000111000000011010100110011010110001010001000100010010010010101000001101000010000010101001001000000100010111000000000000100101011010001100000010011001001010001110100010010100000010011101001010100000000010101000010001101000100011000011000000110000011010011011011000000000000110000110000010101001...

result:

ok 

Test #53:

score: 31
Accepted
time: 8ms
memory: 51988kb

input:

5000
188509 711431
188509 395114
188509 287900
63857 566088
63857 2904
63857 89359
63857 295740
63857 569088
63857 133530
61552 999982
61552 369168
61552 992383
8765 28246
8765 788549
788469 743785
788469 885612
788469 110292
788469 846816
788469 243025
507219 268
507219 496108
507219 750600
507219 ...

output:

011001010011110110010001000001011001100100000010101000010100010100100000001100100100000100101100001100001010000000110011100000000100110001010001101000001100101010001001010001101101010001011000100010101100001000100011001001101001010011000010100010100101010001010101000001000100100011000000100001000110...

result:

ok 

Test #54:

score: 31
Accepted
time: 11ms
memory: 52016kb

input:

5000
284112 849722
284112 532476
284112 373889
284112 139146
284112 76752
284112 395249
713502 332534
713502 448133
713502 912228
474272 477479
474272 714600
237224 228923
237224 15559
237224 700773
237224 777040
237224 814440
630924 847070
630924 142543
630924 804689
630924 254426
630924 400476
630...

output:

101000110011000101000000000100000001100100110001100011000100011001100000101001100010111101000000111000100000110011000110100000000101010010000001110010010101011000001110000111000101000100110101001010000101001010011000101000000010101000100010000100100010001100011000011001010011000000011000110010000010...

result:

ok 

Test #55:

score: 31
Accepted
time: 7ms
memory: 50888kb

input:

5000
514811 435358
514811 227175
514811 67569
514811 642434
514811 399145
514811 396571
514811 262215
514811 49222
514811 356442
514811 98247
514811 386532
514811 747766
514811 272611
514811 977651
514811 917165
514811 409738
606348 806489
606348 349102
606348 36837
606348 646442
606348 440537
60634...

output:

000011000000000001010000000000000010000000000010000010010000000000000000000100001000000010001000000000000000000010001000100000000000000000101000000000000010001000000000000000000001000000000000010000000000000010000000100000000000000010000010000010000010000011000000001000000000000001001000010000000001...

result:

ok 

Test #56:

score: 31
Accepted
time: 11ms
memory: 51632kb

input:

5000
997205 907377
997205 590806
997205 340295
997205 835893
997205 333511
997205 837781
997205 348075
997205 803621
997205 478469
616859 565199
616859 979678
616859 314723
616859 349913
616859 502185
616859 260865
616859 215651
616859 159766
616859 36718
616859 837781
616859 921094
616859 923783
61...

output:

100010000100000000000010000000100100000100000001000000000000001010000000000010000100000001000000100100001000000001000001000000000100000000010000000000000000010001000011000000001100000000000000000000001000000000110000000010000000000000000100000000010000001000000010000000000010100000000100001000000000...

result:

ok 

Test #57:

score: 31
Accepted
time: 7ms
memory: 51564kb

input:

5000
255576 208311
255576 425466
255576 616019
255576 752347
255576 612404
255576 813949
255576 878399
255576 679621
255576 599017
255576 71827
255576 20771
255576 994833
255576 997464
255576 92418
189260 70197
189260 39921
189260 31685
189260 999881
189260 394866
189260 104670
189260 740999
189260 ...

output:

010000010000000010000010000000000000000100000010001000000000000010000010000000101000000000000001000000010000000000000000000110000000000000001010000000100000000001000000001000100000010010000001000000000000100000000010010010000000001000000000000000100000000000110000000000000110000000000000010001000000...

result:

ok 

Test #58:

score: 0
Runtime Error

input:

5000
522009 520563
522009 80886
522009 484712
522009 718828
522009 692233
522009 949811
522009 915086
522009 855745
522009 276926
522009 40640
522009 636953
522009 563507
522009 528287
522009 391871
522009 753227
550240 80886
550240 576958
550240 328989
550240 295840
550240 371137
550240 551272
5502...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Runtime Error

Test #85:

score: 19
Accepted
time: 206ms
memory: 76444kb

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: 198ms
memory: 76600kb

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: 199ms
memory: 76520kb

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
Runtime Error

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:


result: