QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#418114#8588. Amusement ParkUmairAhmadMIrza100 ✓220ms19896kbC++171.7kb2024-05-23 10:51:432024-05-23 10:51:45

Judging History

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

  • [2024-05-23 10:51:45]
  • 评测
  • 测评结果:100
  • 用时:220ms
  • 内存:19896kb
  • [2024-05-23 10:51:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long
int const N=2e5+5;
int const inf=1e12+1;

int val[N];
int seg[4*N];
int n;
void update(int p,int x,int node=1,int s=0,int e=n){
	if(s+1==e){
		seg[node]=x;
		return;
	}
	int mid=(s+e)/2;
	if(p<mid)
		update(p,x,node*2,s,mid);
	else
		update(p,x,node*2+1,mid,e);
	seg[node]=min(seg[node*2],seg[node*2+1]);
}
int query(int x,int node=1,int s=0,int e=n){
	if(s+1==e)
		return s;
	int mid=(s+e)/2;
	if(seg[node*2]<=x)
		return query(x,node*2,s,mid);
	else
		return query(x,node*2+1,mid,e);
}
// void update(int p,int x){
// 	//done
// 	return;
// }
// int query(int x){
// 	for(int i=0;i<n;i++)
// 		if(val[i]<=x)
// 			return i;
// 	return n-1;
// }
signed main(){
	cin>>n;
	int id=0;
	set<int> will;
	for(int i=0;i<n-1;i++){
		val[i]=inf;
		update(i,inf);
	}
	val[n-1]=0;
	update(n-1,0);
	for(int qq=0;qq<n;qq++){
		int t;
		cin>>t;
		if(t==1){
			int x,w;
			cin>>x>>w;
			val[id]=x;
			update(id,x);
			if(w)
				will.insert(id);
			id++;
		}
		else if(t==2){
			int d;
			cin>>d;
			d--;
			val[d]=inf;
			update(d,inf);
			will.erase(d);
		}
		else{
			int cap;
			cin>>cap;
			vector<pair<int,int>> ans;
			while(cap){
				int unw=query(cap);
				int wl=n-1;
				if(will.size())
					wl=*(will.begin());
				if(unw>=n-1 && wl>=n-1)
					break;
				if(unw<=wl){
					ans.push_back({unw+1,val[unw]});
					cap-=val[unw];
					val[unw]=inf;
					update(unw,inf);
					will.erase(unw);
				}
				else{
					ans.push_back({wl+1,cap});
					val[wl]-=cap;
					update(wl,val[wl]);
					cap=0;
				}
			}
			cout<<ans.size()<<endl;
			for(auto i:ans)
				cout<<i.first<<' '<<i.second<<endl;
		}
	}
	return 0;
}

詳細信息

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 0ms
memory: 5656kb

input:

7
1 2 0
1 6 0
1 6 1
3 5
2 2
1 3 0
3 123456789012

output:

2
1 2
3 3
2
3 3
4 3

result:

ok 6 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

5
1 1 0
1 1 0
1 1 0
3 2
1 1 0

output:

2
1 1
2 1

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 1ms
memory: 5588kb

input:

4
1 19 1
3 10
3 10
3 10

output:

1
1 10
1
1 9
0

result:

ok 5 lines

Test #4:

score: 0
Accepted
time: 2ms
memory: 5908kb

input:

1000
1 103259 0
1 128742 0
1 58949 0
1 147463 1
1 122606 0
3 182905
1 132106 0
1 40502 1
1 123736 1
1 4543 1
1 163109 1
1 41758 0
1 176061 0
3 178835
3 184068
3 195391
1 86319 0
1 80890 1
1 121580 0
1 52574 0
1 184660 0
1 183865 0
1 160678 0
1 7243 1
1 4283 1
1 160664 0
1 161622 0
1 193227 0
1 41195...

output:

3
1 103259
3 58949
4 20697
2
2 128742
4 50093
3
4 76673
7 40502
8 66893
4
5 122606
8 56843
9 4543
10 11399
2
6 132106
10 16915
2
10 134795
14 33793
3
11 41758
13 86319
14 38124
3
12 176061
14 8973
20 3673
2
15 121580
20 3440
5
16 52574
20 130
21 4283
25 41195
26 54945
2
19 160678
26 12739
2
17 18466...

result:

ok 332 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 5688kb

input:

1000
1 123100 1
1 49242 0
3 150789
1 55998 1
1 118853 0
1 70681 0
1 89327 1
1 94934 0
1 131426 1
1 82943 0
1 198159 1
1 78513 0
1 39520 0
1 176274 0
1 139133 0
1 178706 1
1 133027 1
1 165803 0
1 184480 0
1 72242 1
1 188024 1
1 159221 1
1 195258 1
1 10180 0
1 146061 0
1 119567 0
1 30784 0
1 148925 0
...

output:

1
1 123100
4
2 49242
3 55998
5 70681
6 13982
3
4 118853
6 75345
8 2849
2
7 94934
8 103536
3
8 25041
9 82943
10 41352
2
10 156807
15 34981
3
11 78513
12 39520
15 56354
2
15 87371
16 2237
2
16 130790
19 4061
2
14 139133
19 29579
2
13 176274
19 899
2
17 165803
19 12104
2
19 25599
20 90548
2
20 97476
21...

result:

ok 709 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 5568kb

input:

999
1 6568 0
1 7724 1
1 10884 1
1 14858 0
1 12636 0
1 4638 0
1 6294 1
1 930 1
1 7598 1
1 13032 1
3 194159
1 5492 0
1 9758 1
1 22272 1
1 15578 1
1 21824 0
1 18437 1
1 1705 0
1 50847 0
1 58929 0
1 24249 0
1 2666 0
1 11356 0
1 59660 1
1 8922 0
1 22613 1
1 20235 1
1 14948 0
1 5834 1
3 157326
1 29 0
1 46...

output:

10
1 6568
2 7724
3 10884
4 14858
5 12636
6 4638
7 6294
8 930
9 7598
10 13032
10
11 5492
12 9758
13 22272
14 15578
15 21824
16 18437
17 1705
18 50847
21 2666
23 8747
6
19 58929
20 24249
22 11356
23 50913
24 8922
25 5722
8
25 16891
26 20235
27 14948
28 5834
29 29
30 46086
31 11463
32 41554
15
32 21366...

result:

ok 561 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 5916kb

input:

1000
1 103350 0
1 189439 0
1 130699 1
3 172553
2 3
1 13483 0
1 79841 1
3 181108
3 85311
3 165314
2 2
1 109851 1
1 116077 0
1 25853 0
1 196808 1
1 98120 0
3 137859
1 32145 1
1 71266 0
1 125823 1
1 156368 0
1 24888 1
1 133918 1
1 137268 1
1 197549 1
1 13281 0
3 165636
1 43667 0
1 98661 1
2 19
1 160440...

output:

2
1 103350
3 69203
2
4 13483
5 79841
0
0
3
6 109851
8 25853
9 2155
2
7 116077
9 49559
1
9 144413
4
9 681
10 98120
11 32145
13 20167
2
12 71266
13 68879
2
14 156368
15 17918
2
15 6970
16 92774
3
16 41144
17 137268
22 18770
2
20 43667
22 137519
3
22 4151
23 65942
24 101518
2
24 24414
26 144654
3
26 31...

result:

ok 319 lines

Test #8:

score: 0
Accepted
time: 2ms
memory: 5684kb

input:

1000
1 49693 0
1 28707 0
1 125533 1
1 6429 0
1 100916 1
1 91170 1
1 175905 1
3 112251
1 54647 1
1 491 1
3 191500
1 11933 1
1 162618 1
1 17965 1
3 144646
1 180344 1
2 8
2 10
1 131339 1
1 56781 0
1 46838 1
2 15
1 44841 1
1 155056 1
1 147313 0
1 14111 0
1 101623 0
1 167882 1
3 177532
2 16
3 193699
2 21...

output:

3
1 49693
2 28707
3 33851
3
3 91682
4 6429
5 93389
3
5 7527
6 91170
7 45949
3
7 129956
9 491
11 47085
3
11 115533
12 17965
13 60201
2
13 120143
14 61986
2
14 69353
17 828
2
17 44013
18 98911
3
18 56145
20 14111
22 22582
2
19 147313
22 46389
2
22 98911
24 1432
2
23 62863
24 118515
6
24 25041
25 50452...

result:

ok 557 lines

Test #9:

score: 0
Accepted
time: 0ms
memory: 5648kb

input:

999
1 12115 1
1 38520 0
1 4535 1
3 168348
1 22359 0
1 11811 1
1 24279 1
2 6
1 21916 1
1 20493 1
1 47556 0
1 33313 1
2 8
1 12498 0
1 14734 1
1 11907 0
1 54670 1
1 31512 0
1 8922 0
1 5174 1
1 14656 1
1 56198 1
1 6425 1
1 8135 1
1 19107 1
1 16387 1
1 3772 1
1 2200 1
1 14251 0
3 177075
1 1505 0
2 22
1 9...

output:

3
1 12115
2 38520
3 4535
9
4 22359
5 11811
7 21916
9 47556
10 33313
11 12498
12 14734
13 11907
14 981
9
14 53689
15 31512
16 8922
17 5174
18 14656
19 56198
20 6425
21 8135
23 3784
18
23 12603
29 4843
30 5155
31 21449
32 2323
33 11179
34 9588
35 7663
36 8309
37 9263
38 4578
39 11752
40 2319
42 3947
4...

result:

ok 511 lines

Test #10:

score: 0
Accepted
time: 3ms
memory: 5828kb

input:

1000
3 908267403778
3 630570612070
3 693850542431
3 707159246006
3 75249429890
3 768022897542
3 806373428439
3 42247637186
3 355035968748
3 963115188409
3 641346925297
3 533712741793
3 537198263359
3 819173894161
3 15273348814
3 855864932228
3 845323743677
3 671368268509
3 906912409038
3 28082432227...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 1000 lines

Subtask #2:

score: 7
Accepted

Test #11:

score: 7
Accepted
time: 165ms
memory: 15820kb

input:

200000
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0...

output:

199999
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
61...

result:

ok 200000 lines

Test #12:

score: 0
Accepted
time: 140ms
memory: 11640kb

input:

199999
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
3 10
1 1 0
1 1 0
1 1 0
3 5
1 1 0
3 4
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
3 2
1 1 0
1 1 0
1 1 0
1 1 0
3 1
1 1 0
1 1 0
1 1 0
1 1 0
3 5
1 1 0
1 1 0
1 1 0
1 1 0
1 1 ...

output:

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

result:

ok 117470 lines

Test #13:

score: 0
Accepted
time: 114ms
memory: 11644kb

input:

199998
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0...

output:

538
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
61 1
...

result:

ok 104375 lines

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #14:

score: 20
Accepted
time: 155ms
memory: 11448kb

input:

200000
1 4 0
1 10 0
1 9 0
1 9 0
1 1 0
1 8 0
3 707714796138
1 6 0
1 1 0
1 8 0
1 5 0
1 1 0
1 3 0
1 3 0
1 8 0
1 2 0
1 2 0
1 1 0
1 3 0
1 3 0
1 10 0
1 3 0
1 2 0
1 4 0
1 4 0
1 6 0
1 5 0
1 1 0
1 8 0
1 7 0
1 1 0
1 4 0
1 9 0
1 6 0
1 7 0
1 5 0
1 4 0
1 3 0
1 7 0
1 1 0
1 5 0
1 1 0
1 10 0
1 3 0
1 6 0
3 443456506...

output:

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

result:

ok 200000 lines

Test #15:

score: 0
Accepted
time: 169ms
memory: 11720kb

input:

200000
1 3 0
1 2 0
1 8 0
1 8 0
1 4 0
1 3 0
1 3 0
1 3 0
1 6 0
1 8 0
1 1 0
1 5 0
1 6 0
1 5 0
1 10 0
1 2 0
1 6 0
1 9 0
1 6 0
1 10 0
1 3 0
1 8 0
1 5 0
1 2 0
1 4 0
1 7 0
1 6 0
1 1 0
1 7 0
1 9 0
1 8 0
1 2 0
1 2 0
1 7 0
1 4 0
1 7 0
1 10 0
1 3 0
1 3 0
1 10 0
1 1 0
1 1 0
1 7 0
1 5 0
1 8 0
1 6 0
1 2 0
1 8 0
1...

output:

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

result:

ok 200000 lines

Test #16:

score: 0
Accepted
time: 181ms
memory: 11700kb

input:

200000
1 1 0
1 4 0
1 5 0
1 6 0
1 5 0
1 9 0
1 4 0
1 2 0
1 8 0
1 2 0
1 1 0
1 3 0
1 10 0
1 7 0
1 9 0
1 2 0
1 7 0
1 6 0
1 5 0
1 6 0
1 5 0
1 6 0
1 1 0
1 7 0
1 2 0
1 3 0
1 6 0
1 6 0
1 1 0
1 10 0
1 6 0
1 3 0
1 7 0
1 4 0
1 7 0
1 8 0
1 10 0
1 5 0
1 10 0
1 4 0
1 7 0
1 9 0
1 5 0
1 7 0
1 10 0
1 3 0
1 6 0
1 8 0
...

output:

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

result:

ok 200000 lines

Test #17:

score: 0
Accepted
time: 190ms
memory: 12960kb

input:

200000
1 5 0
1 6 0
1 6 0
1 1 0
1 2 0
1 10 0
1 1 0
1 1 0
1 10 0
1 10 0
1 7 0
1 7 0
1 1 0
1 3 0
1 5 0
1 2 0
1 6 0
1 1 0
1 8 0
1 6 0
1 6 0
1 5 0
1 7 0
1 3 0
1 9 0
1 3 0
1 10 0
1 7 0
1 5 0
1 2 0
1 1 0
1 10 0
1 1 0
1 6 0
1 10 0
1 6 0
1 10 0
1 3 0
1 9 0
1 7 0
1 8 0
1 5 0
1 8 0
1 5 0
1 1 0
1 6 0
1 2 0
1 6 ...

output:

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

result:

ok 200000 lines

Test #18:

score: 0
Accepted
time: 112ms
memory: 11412kb

input:

200000
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0...

output:

1
1 10
1
59699 5
1
23746 8
1
11874 9
1
47867 6
1
95957 2
1
35761 7
1
2 10
1
47868 6
1
47869 6
1
59700 5
1
23747 8
1
71763 4
1
35762 7
1
11875 9
1
23748 8
1
3 10
1
4 10
1
47870 6
1
47871 6
1
59701 5
1
71764 4
1
11876 9
1
95958 2
1
108030 1
1
71765 4
1
23749 8
1
47872 6
1
5 10
1
47873 6
1
11877 9
1
95...

result:

ok 160000 lines

Subtask #4:

score: 16
Accepted

Dependency #3:

100%
Accepted

Test #19:

score: 16
Accepted
time: 183ms
memory: 11340kb

input:

200000
1 10 0
1 7 0
1 5 0
1 9 0
1 5 0
1 3 0
1 10 0
1 8 0
1 3 1
1 9 1
1 7 0
1 5 1
1 1 0
1 3 0
1 10 1
1 8 0
1 7 1
1 10 1
1 1 1
1 4 1
1 4 0
1 9 0
1 3 1
1 10 1
1 4 1
1 8 0
1 5 0
1 7 1
1 7 0
1 3 1
1 2 1
1 3 1
1 6 0
1 4 0
1 8 1
1 3 0
1 5 1
1 2 0
1 10 0
1 3 0
1 5 0
1 5 0
1 8 0
1 9 0
1 10 0
1 2 1
1 10 0
1 8...

output:

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

result:

ok 200000 lines

Test #20:

score: 0
Accepted
time: 153ms
memory: 18856kb

input:

199999
1 1 1
1 5 1
1 3 1
1 4 1
1 4 1
1 7 1
1 2 1
1 4 1
1 3 1
1 9 1
3 5
1 2 1
3 1
1 2 1
1 5 1
1 7 1
1 2 1
1 6 1
1 4 1
1 6 1
3 2
3 9
1 5 1
1 8 1
1 5 1
1 5 1
1 9 1
1 9 1
1 2 1
1 10 1
1 2 1
3 7
3 4
1 5 1
1 7 1
1 7 1
1 10 1
1 4 1
1 4 1
1 9 1
3 4
1 5 1
1 5 1
1 1 1
1 6 1
1 3 1
1 1 1
1 10 1
1 7 1
1 2 1
1 2 ...

output:

2
1 1
2 4
1
2 1
1
3 2
3
3 1
4 4
5 4
1
6 7
2
7 2
8 2
2
8 2
9 2
2
9 1
10 1
1
10 8
3
11 2
12 2
13 4
2
13 1
14 5
3
14 2
15 2
16 2
1
16 4
2
17 4
18 2
1
18 3
3
18 1
19 5
20 1
1
20 4
2
20 3
21 2
2
21 3
22 2
2
22 3
23 6
2
23 3
24 7
3
24 2
25 2
26 5
1
26 3
1
26 2
2
27 2
28 1
2
28 4
29 5
2
29 2
30 7
1
31 8
2
...

result:

ok 50377 lines

Test #21:

score: 0
Accepted
time: 122ms
memory: 15352kb

input:

200000
1 5 0
1 7 1
1 4 1
1 1 0
1 1 1
1 2 1
1 9 0
1 5 1
1 10 0
1 5 1
1 5 1
1 8 1
1 5 0
1 6 1
1 2 0
1 2 1
1 3 0
1 3 1
1 2 1
1 7 0
1 7 1
1 10 0
1 8 1
1 8 0
1 5 0
1 9 0
1 4 0
1 3 1
1 10 0
1 9 0
1 10 1
1 5 0
1 3 1
1 3 0
1 9 0
1 10 1
1 5 0
1 7 0
1 4 0
1 4 1
1 3 1
1 4 0
1 6 0
1 2 1
1 1 1
1 3 1
1 8 1
1 4 1
...

output:

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

result:

ok 42369 lines

Test #22:

score: 0
Accepted
time: 121ms
memory: 19896kb

input:

200000
1 2 1
1 3 1
1 10 1
1 9 1
1 6 1
1 7 1
1 6 1
1 2 1
1 4 1
1 5 1
1 5 1
1 7 1
1 8 1
1 8 1
1 3 1
1 1 1
1 10 1
1 8 1
1 7 1
1 10 1
1 8 1
1 1 1
1 1 1
1 1 1
1 4 1
1 3 1
1 2 1
1 6 1
1 2 1
1 1 1
1 2 1
1 4 1
1 6 1
1 5 1
1 6 1
1 9 1
1 3 1
1 8 1
1 7 1
1 10 1
1 10 1
1 2 1
1 6 1
1 6 1
1 1 1
1 10 1
1 10 1
1 1 ...

output:

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

result:

ok 25867 lines

Test #23:

score: 0
Accepted
time: 112ms
memory: 11900kb

input:

200000
1 10 1
1 4 0
1 9 0
1 3 0
1 8 1
1 10 0
1 4 0
3 33
1 6 0
1 8 1
1 2 0
1 6 0
1 9 0
1 3 0
1 8 0
1 4 0
3 50
1 3 0
1 8 0
1 1 0
1 7 0
1 3 0
3 50
1 10 0
1 6 0
1 7 0
1 5 0
3 43
1 3 0
1 3 0
1 7 0
1 1 0
1 2 0
1 6 0
1 7 0
1 3 0
3 45
1 5 0
1 4 0
1 9 0
3 25
1 7 0
1 10 0
1 3 0
1 2 0
1 9 0
1 5 1
1 7 0
1 6 0
1...

output:

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

result:

ok 89352 lines

Subtask #5:

score: 10
Accepted

Dependency #4:

100%
Accepted

Test #24:

score: 10
Accepted
time: 95ms
memory: 11908kb

input:

200000
1 5 0
1 9 1
1 10 0
1 8 0
2 1
1 2 0
1 3 0
2 5
1 1 0
1 7 0
1 10 0
1 1 0
2 3
1 3 0
2 6
1 8 0
1 3 0
1 7 0
1 10 0
1 8 0
1 10 0
1 4 0
1 9 0
2 4
1 6 0
1 4 0
2 9
2 2
2 14
1 9 1
1 3 0
1 2 0
1 1 0
3 11
2 15
2 12
1 4 0
3 12
2 17
1 3 0
1 10 0
2 25
3 6
1 9 0
1 2 1
1 6 0
1 9 0
1 5 0
1 4 1
2 19
1 9 0
1 4 0
...

output:

4
7 1
8 7
10 1
22 2
4
11 3
13 3
18 4
22 2
1
20 6
3
38 1
39 6
58 2
2
52 6
60 2
4
57 8
64 4
76 1
90 5
4
94 9
95 3
97 2
100 3
1
103 3
5
103 3
105 2
109 6
111 2
128 4
4
120 10
131 2
134 5
140 2
2
137 7
140 1
4
139 4
140 2
141 10
158 1
3
146 10
147 2
149 3
1
214 1
6
162 2
175 6
178 3
186 3
189 2
224 1
4
...

result:

ok 10911 lines

Test #25:

score: 0
Accepted
time: 92ms
memory: 11904kb

input:

200000
1 6 0
2 1
1 10 0
1 5 0
2 3
1 8 0
1 5 0
1 2 0
2 5
1 6 0
1 9 0
1 6 0
3 1
2 9
1 10 0
2 7
1 3 0
1 3 0
2 12
2 10
1 1 0
2 8
1 7 0
1 10 0
2 14
2 13
1 2 1
2 6
1 8 0
1 9 0
2 18
1 4 0
1 5 0
2 19
1 4 0
1 7 0
2 16
1 1 0
1 10 0
1 8 0
1 5 0
2 21
1 8 0
1 1 1
1 2 0
1 3 0
1 6 0
1 9 0
1 8 1
1 9 0
2 34
1 8 0
2 ...

output:

0
3
2 10
11 3
20 5
2
15 10
22 7
5
17 8
23 1
28 1
29 2
39 4
1
51 1
1
44 7
1
35 8
2
24 10
51 3
1
51 6
1
32 9
1
62 3
2
40 10
63 5
2
42 8
63 2
1
63 1
2
49 7
63 1
4
56 8
65 6
68 1
73 2
1
76 3
3
69 7
75 7
76 1
2
74 9
81 1
2
79 9
87 1
3
83 5
88 2
90 1
1
80 9
3
84 4
86 8
90 1
6
90 2
91 6
95 1
96 7
99 2
130 ...

result:

ok 10627 lines

Test #26:

score: 0
Accepted
time: 117ms
memory: 11416kb

input:

200000
1 9 0
1 1 1
1 6 0
1 4 1
1 4 0
2 2
2 3
2 4
1 1 1
2 1
1 4 1
2 5
1 8 0
1 4 0
2 8
1 7 1
1 8 1
1 1 1
1 8 0
1 7 0
2 10
3 494
1 8 0
2 15
1 6 0
1 2 1
3 435
1 3 0
1 5 1
1 5 0
2 19
2 18
1 7 0
1 4 0
2 20
2 21
2 22
1 8 0
2 23
1 8 0
1 5 0
1 9 0
2 24
1 6 1
1 10 1
1 9 1
1 5 0
2 29
1 10 0
2 26
2 30
1 8 1
1 8...

output:

7
6 1
7 4
9 4
11 8
12 1
13 8
14 7
2
16 6
17 2
8
25 5
27 6
28 10
32 8
33 8
35 1
36 2
37 9
5
56 2
57 1
58 4
59 6
60 9
1
68 3
11
64 6
68 1
70 4
72 7
73 7
75 7
76 6
77 7
78 5
79 10
80 10
6
86 5
87 3
88 1
90 4
93 3
94 7
5
100 6
102 8
105 1
106 8
108 1
2
112 6
113 1
6
119 7
120 8
121 5
122 3
123 9
124 5
4...

result:

ok 63774 lines

Test #27:

score: 0
Accepted
time: 122ms
memory: 13112kb

input:

200000
1 6 0
1 1 0
1 6 0
2 2
1 10 0
1 7 0
2 5
1 7 0
1 10 0
1 10 0
1 2 0
1 6 0
1 2 0
1 5 0
1 10 0
1 4 0
2 10
1 9 0
1 9 0
2 9
2 16
1 2 0
1 5 0
1 7 0
2 18
1 2 0
2 6
1 3 0
1 7 0
1 9 0
1 6 0
1 10 0
1 6 0
2 23
1 10 0
1 3 0
1 5 0
1 7 0
1 7 0
1 3 0
1 7 0
2 4
1 2 0
2 8
1 10 0
1 5 0
1 6 0
1 10 0
2 17
1 7 0
1 ...

output:

12604
1 6
3 6
11 2
24 6
26 6
27 10
30 7
37 6
38 10
44 10
51 9
56 2
60 6
61 3
63 2
68 4
69 10
70 7
73 6
75 8
76 6
86 4
87 5
89 6
92 1
94 8
95 10
96 10
99 9
100 8
106 6
110 1
117 10
118 8
127 3
129 3
130 7
133 5
134 10
135 3
143 9
148 6
149 10
150 3
154 9
156 1
158 3
159 6
165 10
168 4
170 3
171 7
176...

result:

ok 119333 lines

Test #28:

score: 0
Accepted
time: 140ms
memory: 12520kb

input:

200000
1 1 0
1 4 0
1 9 0
1 7 0
1 6 0
1 8 0
1 10 0
1 5 0
1 8 0
1 10 0
1 10 0
1 9 0
1 8 0
1 6 0
1 8 0
1 3 0
1 3 0
1 8 0
1 7 0
1 3 0
2 1
1 8 0
1 10 0
2 3
1 5 0
1 4 1
1 4 0
2 7
1 4 0
1 7 0
1 2 0
1 10 0
2 6
1 10 0
1 8 0
1 5 0
1 6 0
1 8 0
1 3 0
2 9
1 6 0
2 5
1 9 0
1 8 0
1 6 0
1 2 0
1 5 0
2 10
1 7 0
1 2 0
...

output:

16794
182 6
262 8
289 1
344 10
418 9
443 2
453 5
498 1
523 3
582 3
609 4
670 5
694 1
704 10
724 3
727 4
729 8
742 1
768 7
784 9
796 8
808 7
840 2
877 9
901 8
913 3
914 3
916 9
932 9
947 6
990 7
993 9
1018 6
1075 2
1078 2
1115 10
1129 1
1132 10
1144 9
1161 3
1162 9
1169 7
1177 1
1184 1
1190 4
1211 7
...

result:

ok 133422 lines

Test #29:

score: 0
Accepted
time: 123ms
memory: 11336kb

input:

200000
1 10 0
1 6 0
2 2
1 8 0
1 4 0
2 4
2 3
1 3 1
1 8 0
1 7 0
1 3 0
1 6 0
2 9
1 6 0
1 1 0
2 11
1 6 0
1 4 0
1 10 0
2 13
2 12
1 4 0
1 5 0
2 16
2 15
2 14
1 3 1
2 17
1 8 0
1 2 0
1 7 0
2 18
1 6 0
1 3 0
1 10 0
1 8 0
2 21
1 1 0
1 1 0
1 8 0
1 8 0
1 3 0
1 1 0
1 3 0
1 8 0
1 5 1
1 1 0
1 8 0
1 6 0
1 5 0
1 4 0
1...

output:

4849
1 10
5 3
6 8
7 7
8 3
10 6
19 2
20 7
22 3
23 10
24 8
25 1
26 1
27 8
28 8
29 3
30 1
31 3
32 8
33 5
34 1
35 8
36 6
37 5
38 4
39 8
40 9
41 3
43 9
44 4
45 8
46 2
47 8
48 8
49 6
50 10
54 6
56 1
57 10
58 7
59 10
60 1
61 9
62 5
63 4
64 2
65 10
66 6
67 10
69 8
70 9
71 9
72 1
73 10
77 1
78 10
81 1
84 7
8...

result:

ok 133530 lines

Test #30:

score: 0
Accepted
time: 132ms
memory: 11412kb

input:

200000
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0
1 10 0...

output:

1
82554 3
1
82555 3
1
70648 4
1
1 10
1
82556 3
1
11712 9
1
58878 5
1
105915 1
1
70649 4
1
35397 7
1
35398 7
1
11713 9
1
94302 2
1
47195 6
1
70650 4
1
11714 9
1
58879 5
1
58880 5
1
23486 8
1
35399 7
1
47196 6
1
11715 9
1
2 10
1
47197 6
1
47198 6
1
82557 3
1
23487 8
1
94303 2
1
58881 5
1
23488 8
1
234...

result:

ok 141268 lines

Subtask #6:

score: 35
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #31:

score: 35
Accepted
time: 189ms
memory: 16768kb

input:

200000
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 200000 0
1 20000...

output:

199999
1 200000
2 200000
3 200000
4 200000
5 200000
6 200000
7 200000
8 200000
9 200000
10 200000
11 200000
12 200000
13 200000
14 200000
15 200000
16 200000
17 200000
18 200000
19 200000
20 200000
21 200000
22 200000
23 200000
24 200000
25 200000
26 200000
27 200000
28 200000
29 200000
30 200000
31...

result:

ok 200000 lines

Test #32:

score: 0
Accepted
time: 220ms
memory: 11612kb

input:

200000
1 187542 1
3 179059
1 185994 1
1 198984 1
1 196011 1
3 183389
3 145471
1 188980 1
3 178126
3 183186
1 174466 1
3 157551
3 170767
1 191101 1
3 161638
1 186798 1
1 166493 1
3 171118
1 180406 1
1 165351 1
1 170117 1
1 199267 1
3 105612
3 129429
1 172302 1
1 188180 1
3 121495
1 148891 1
3 178865
...

output:

1
1 179059
2
1 8483
2 174906
2
2 11088
3 134383
2
3 64601
4 113525
2
4 82486
5 100700
2
5 88280
6 69271
1
6 105195
1
7 161638
2
7 29463
8 141655
2
8 45143
9 60469
2
9 106024
10 23405
1
10 121495
2
10 35506
11 143359
2
11 21992
12 73480
2
12 96637
13 31225
2
13 168042
14 14885
2
14 157417
15 33192
2
...

result:

ok 291775 lines

Test #33:

score: 0
Accepted
time: 160ms
memory: 19880kb

input:

200000
1 168736 1
1 149646 1
1 170295 1
1 118296 1
1 190471 1
1 176618 1
1 193578 1
1 169908 1
1 197597 1
1 166086 1
1 170646 1
1 123099 1
1 160803 1
1 152869 1
1 161142 1
1 180905 1
1 156412 1
1 169569 1
1 180532 1
1 199383 1
1 163836 1
1 198006 1
1 189002 1
1 195350 1
1 192929 1
1 168457 1
1 14098...

output:

11991
1 168736
2 149646
3 170295
4 118296
5 190471
6 176618
7 193578
8 169908
9 197597
10 166086
11 170646
12 123099
13 160803
14 152869
15 161142
16 180905
17 156412
18 169569
19 180532
20 199383
21 163836
22 198006
23 189002
24 195350
25 192929
26 168457
27 140983
28 190751
29 173235
30 145881
31 ...

result:

ok 40938 lines

Test #34:

score: 0
Accepted
time: 161ms
memory: 11352kb

input:

199999
1 95900 0
1 118021 0
1 173975 0
1 189120 0
1 88482 0
1 156186 0
1 91348 0
1 82229 0
1 76050 0
1 160480 0
1 18451 0
1 145142 0
1 36390 0
1 5562 0
1 26011 0
3 827017
1 162126 0
1 197685 0
1 57933 0
1 11535 0
1 149203 0
3 940353
1 6112 0
1 183444 0
1 91353 0
1 157455 0
1 160307 0
1 180501 0
1 71...

output:

6
1 95900
2 118021
3 173975
4 189120
5 88482
6 156186
12
7 91348
8 82229
9 76050
10 160480
11 18451
12 145142
13 36390
14 5562
15 26011
16 162126
18 57933
19 11535
2
21 6112
23 91353
1
20 149203
7
17 197685
22 183444
24 157455
25 160307
26 180501
27 71568
30 44770
2
28 91356
53 15561
5
29 132119
31 ...

result:

ok 114238 lines

Test #35:

score: 0
Accepted
time: 141ms
memory: 11616kb

input:

200000
1 6535 0
1 168967 0
1 26070 0
1 136667 0
1 141768 0
1 15636 0
1 98841 0
1 167546 0
1 100738 0
1 184049 0
1 132602 0
1 95101 0
1 91370 0
1 135292 0
1 43546 0
1 129804 0
1 162860 0
1 142020 0
1 26456 0
1 95779 0
1 133515 0
1 51102 0
1 175062 0
1 13313 0
1 169546 0
1 196660 0
1 182206 0
1 42723 ...

output:

17
1 6535
2 168967
3 26070
4 136667
5 141768
6 15636
7 98841
8 167546
9 100738
10 184049
11 132602
12 95101
13 91370
14 135292
62 1478
92 869
165 3487
42
15 43546
16 129804
17 162860
18 142020
19 26456
20 95779
21 133515
22 51102
23 175062
24 13313
25 169546
26 196660
27 182206
28 42723
29 89228
30 ...

result:

ok 98322 lines

Test #36:

score: 0
Accepted
time: 116ms
memory: 11548kb

input:

200000
1 120401 0
1 34740 0
1 50681 0
1 98714 0
1 95345 0
1 55638 0
1 104357 0
1 99628 0
1 57184 0
1 1268 0
1 114582 0
1 145318 0
1 4420 0
1 98025 0
1 187144 0
1 69102 0
1 186848 0
1 88406 0
1 150585 0
1 180467 0
1 48 0
1 132144 0
1 115695 0
1 31387 0
1 168787 0
1 64030 0
1 11707 0
1 117371 0
1 2871...

output:

41
1 120401
2 34740
3 50681
4 98714
5 95345
6 55638
7 104357
8 99628
9 57184
10 1268
11 114582
12 145318
13 4420
14 98025
15 187144
16 69102
17 186848
18 88406
19 150585
20 180467
21 48
22 132144
23 115695
24 31387
25 168787
26 64030
27 11707
28 117371
29 28718
30 16898
31 108286
32 149900
33 170319...

result:

ok 55465 lines

Test #37:

score: 0
Accepted
time: 179ms
memory: 14428kb

input:

200000
1 158436 0
1 104757 0
1 44894 0
1 148954 0
1 128156 0
1 64118 0
1 176629 0
1 64849 0
1 88446 0
1 65887 0
1 82620 0
1 2240 0
1 193498 0
1 193684 0
1 81985 0
1 21017 0
1 104952 0
1 30507 0
1 63105 0
1 71959 0
1 183251 0
1 175527 0
1 95692 0
1 137617 0
1 164452 0
1 84265 0
1 48867 0
1 82574 0
1 ...

output:

10104
1 158436
2 104757
3 44894
4 148954
5 128156
6 64118
7 176629
8 64849
9 88446
10 65887
11 82620
12 2240
13 193498
14 193684
15 81985
16 21017
17 104952
18 30507
19 63105
20 71959
21 183251
22 175527
23 95692
24 137617
25 164452
26 84265
27 48867
28 82574
29 129186
30 196452
31 189924
32 14618
3...

result:

ok 200000 lines

Test #38:

score: 0
Accepted
time: 103ms
memory: 11360kb

input:

200000
1 26509 0
2 1
1 33401 0
2 2
1 115771 0
1 159842 0
1 125796 0
2 5
2 3
1 156278 0
1 64600 0
1 141309 0
1 68046 0
1 170791 0
2 4
1 158931 0
2 8
1 155964 0
1 120679 0
1 18537 0
1 48620 0
1 167861 0
1 168718 0
2 16
1 125024 0
1 178714 0
1 189497 0
1 152559 0
1 193825 0
1 9334 0
1 140973 0
1 34342 ...

output:

16
12 155964
19 178714
20 189497
22 193825
25 34342
27 69544
36 177653
39 66128
42 47383
46 35323
48 30524
86 3318
97 13446
123 7529
665 319
1598 73
9
56 149818
59 84189
82 82854
145 6397
150 4465
221 9499
695 3267
834 957
1598 283
11
64 114430
75 142781
76 122291
79 192368
81 159871
93 154246
106 2...

result:

ok 439 lines

Test #39:

score: 0
Accepted
time: 106ms
memory: 11312kb

input:

200000
1 137663 0
1 75268 0
1 44851 0
1 75760 0
2 1
1 32086 0
1 119584 0
1 115808 0
1 33873 0
1 114597 0
1 92147 0
1 156624 0
2 3
1 38651 0
2 2
1 93086 0
1 87945 0
1 53722 0
1 176204 0
1 96492 0
1 28186 0
1 114134 0
1 9613 0
1 148140 0
1 177804 0
1 195224 0
1 51648 0
1 48383 0
1 112551 0
1 27534 0
1...

output:

115
909 70708
915 128087
1269 190698
1353 15447
1434 70859
1479 143282
1513 121961
1607 120397
1969 98996
1979 121137
2068 77744
2096 101193
2207 176449
2369 9552
2530 61247
2549 152389
2657 19625
2718 155182
2780 75808
2813 153389
2847 118007
2857 190766
2886 22685
2930 8779
3140 20181
3223 70389
3...

result:

ok 207 lines

Test #40:

score: 0
Accepted
time: 98ms
memory: 11184kb

input:

200000
1 136124 0
1 161017 0
1 123710 1
1 69168 0
2 4
1 142614 0
1 78905 0
1 173298 0
1 7309 0
1 77488 0
1 153341 0
1 35379 0
1 129905 0
1 179887 0
1 18278 0
1 118683 0
1 159914 0
1 65868 0
2 16
2 17
1 112769 0
1 87288 0
2 19
2 13
2 18
1 120371 0
2 20
1 105957 0
1 126836 0
1 4335 0
1 157077 0
1 1850...

output:

234
1 136124
2 161017
3 123710
5 142614
6 78905
7 173298
8 7309
9 77488
10 153341
11 35379
12 129905
14 18278
15 118683
21 105957
22 126836
23 4335
24 157077
25 18502
26 7604
27 105541
28 111899
29 106939
30 163374
31 161637
32 60909
34 178582
35 140223
37 62432
38 41859
39 118588
41 151300
42 13324...

result:

ok 896 lines

Test #41:

score: 0
Accepted
time: 113ms
memory: 11416kb

input:

200000
1 42776 0
1 197342 0
1 70898 0
1 189158 0
1 103940 0
1 135906 0
1 4341 0
1 129994 0
1 127939 0
1 23560 0
1 110129 0
1 18320 0
1 162895 0
1 186039 0
1 48314 0
1 187860 0
1 64712 0
1 182317 0
1 117688 0
1 89288 0
1 31709 0
1 96462 0
1 78632 0
1 38696 0
1 83375 0
3 158864
1 94854 0
1 154078 0
1 ...

output:

4
1 42776
3 70898
7 4341
10 23560
3
5 103940
12 18320
32 2444
2
11 110129
77 11026
1
65 22967
4
80 2961
119 3345
121 10749
129 2820
4
15 48314
21 31709
109 19577
180 2741
2
24 38696
128 11816
3
6 135906
208 804
214 2071
3
8 129994
82 26210
138 9685
1
17 64712
4
143 13083
162 6665
306 617
327 630
2
1...

result:

ok 24744 lines

Test #42:

score: 0
Accepted
time: 109ms
memory: 11444kb

input:

200000
1 62473 0
1 189988 0
1 137163 0
1 143413 0
1 160021 0
1 185809 0
1 113632 0
1 151337 0
1 146897 0
1 104913 0
1 171561 0
1 119352 0
1 33854 0
1 157135 0
1 150465 0
1 64876 0
1 105573 0
1 73909 0
1 57821 0
1 34326 0
1 35019 0
1 109838 0
1 49948 0
1 75349 0
1 7200 0
1 190890 0
1 59038 0
1 6228 0...

output:

18
1 62473
2 189988
3 137163
4 143413
5 160021
6 185809
7 113632
8 151337
9 146897
10 104913
13 33854
20 34326
25 7200
48 1351
165 1562
433 162
649 74
1380 82
60
11 171561
12 119352
14 157135
15 150465
16 64876
17 105573
18 73909
19 57821
21 35019
22 109838
23 49948
24 75349
26 190890
27 59038
28 62...

result:

ok 3827 lines

Test #43:

score: 0
Accepted
time: 191ms
memory: 11420kb

input:

200000
1 200000 0
1 199998 0
1 199998 0
1 199997 0
1 199997 0
1 199996 0
1 199994 0
1 199993 0
1 199993 0
1 199991 0
1 199990 0
1 199989 0
1 199988 0
1 199986 0
1 199985 0
1 199982 0
1 199981 0
1 199978 0
1 199975 0
1 199974 0
1 199974 0
1 199971 0
1 199967 0
1 199964 0
1 199963 0
1 199961 0
1 19995...

output:

1
53070 111804
1
109681 17373
1
33701 143764
1
84241 59705
1
6716 188562
1
4483 192162
1
60881 98683
1
27551 153943
1
12121 179498
1
13336 177454
1
63924 93643
1
10983 181393
1
37289 137888
1
78711 68981
2
32928 145021
120000 3
1
119608 688
1
106113 23315
1
6949 188128
2
53631 110802
119998 5
1
2491...

result:

ok 160024 lines

Test #44:

score: 0
Accepted
time: 139ms
memory: 9356kb

input:

200000
1 199999 0
1 199998 0
1 199997 0
1 199995 0
1 199993 0
1 199989 0
1 199989 0
1 199988 0
1 199987 0
1 199986 0
1 199985 0
1 199982 0
1 199982 0
1 199981 0
1 199980 0
1 199977 0
1 199977 0
1 199977 0
1 199976 0
1 199976 0
1 199974 0
1 199974 0
1 199973 0
1 199972 0
1 199971 0
1 199971 0
1 19996...

output:

1
29003 150576
2
81568 61079
117646 4
1
24660 157854
2
24119 158748
117647 3
1
24912 157384
1
57511 101943
1
12486 178716
1
9268 184199
1
23351 160087
1
29072 150471
1
112311 8932
1
116068 2568
1
64444 90090
1
80934 62172
2
59425 98699
117645 5
1
56619 103517
1
33543 142920
1
75406 71475
1
36963 137...

result:

ok 141364 lines

Test #45:

score: 0
Accepted
time: 120ms
memory: 11352kb

input:

200000
1 146925 0
1 132039 0
1 179625 0
1 166384 0
1 2871 0
1 28120 0
1 183792 0
1 182055 0
1 104909 0
1 13774 0
1 43566 0
1 26235 0
1 76074 0
1 60656 0
1 163182 0
1 159145 0
1 187965 0
1 27699 0
1 89091 0
1 59238 0
1 37409 0
1 16797 0
1 41691 0
1 188387 0
1 170509 0
1 16938 0
1 66902 0
1 48142 0
1 ...

output:

4
5 2871
6 28120
10 13774
51 1807
1
12 26235
3
11 43566
18 27699
68 10422
3
22 16797
77 9386
216 1849
2
14 60656
330 118
1
258 3382
3
1 146925
21 37409
125 14035
3
2 132039
269 3327
346 3094
4
9 104909
26 16938
29 17934
486 1229
0
2
154 7562
327 3275
3
13 76074
20 59238
378 3245
3
3 179625
4 166384
...

result:

ok 26666 lines