QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#68146#4883. Bayan TestingA_zjzjAC ✓107ms6124kbC++14761b2022-12-14 19:22:052022-12-14 19:22:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-14 19:22:07]
  • 评测
  • 测评结果:AC
  • 用时:107ms
  • 内存:6124kb
  • [2022-12-14 19:22:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;using ll=long long;const int N=2e5+10;
int T,n,m,cnt,fa[N];struct zj{int l,r;}a[N];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
void merge(int x,int y){fa[find(x)]=find(y);}
void get(){
	cnt=0;scanf("%d%d",&n,&m);for(int i=1;i<=m*2;i++)scanf("%d%d",&a[i].l,&a[i].r);iota(fa,fa+1+n,0);
	sort(a+1,a+1+m*2,[](zj x,zj y){return x.l^y.l?x.l<y.l:x.r<y.r;});for(int i=1,j;i<=m*2&&cnt<m;i=j){
		for(j=i+1;j<=m*2&&a[j].l==a[i].l;j++);if(a[i].l==a[i].r)++i;if(i==j)continue;
		if(cnt+j-i<=m)merge(a[i].l,a[i].r),cnt+=j-i;else merge(a[i].l,a[j-(m-cnt)].r),cnt=m;
	}if(cnt^m)puts("-1");else for(int i=1;i<=n;i++)printf("%d%c",find(i),"\n "[i<n]);
}
int main(){
	for(scanf("%d",&T);T--;get());return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3552kb

input:

3
2 1
1 1
2 2
6 2
1 3
4 6
2 4
3 5
4 3
1 2
1 1
2 2
2 3
3 3
3 4

output:

-1
3 4 3 4 5 6
4 4 4 4

result:

ok ok (3 test cases)

Test #2:

score: 0
Accepted
time: 32ms
memory: 3624kb

input:

100000
2 1
1 1
2 2
2 1
2 2
1 2
2 1
1 2
2 2
2 1
1 2
2 2
2 1
2 2
1 2
2 1
2 2
1 1
2 1
1 1
2 2
2 1
1 2
2 2
2 1
2 2
1 1
2 1
2 2
1 2
2 1
2 2
1 1
2 1
2 2
1 2
2 1
2 2
1 2
2 1
2 2
1 1
2 1
2 2
1 1
2 1
1 2
2 2
2 1
2 2
1 2
2 1
2 2
1 2
2 1
2 2
1 2
2 1
1 1
2 2
2 1
2 2
1 2
2 1
1 1
2 2
2 1
1 1
2 2
2 1
2 2
1 2
2 1
2...

output:

-1
2 2
2 2
2 2
2 2
-1
-1
2 2
-1
2 2
-1
2 2
2 2
-1
-1
2 2
2 2
2 2
2 2
-1
2 2
-1
-1
2 2
-1
2 2
2 2
-1
-1
2 2
2 2
-1
2 2
2 2
2 2
2 2
2 2
2 2
2 2
2 2
-1
2 2
2 2
2 2
2 2
2 2
2 2
-1
2 2
2 2
2 2
2 2
-1
2 2
-1
2 2
2 2
2 2
2 2
2 2
2 2
2 2
-1
2 2
2 2
2 2
-1
-1
2 2
-1
2 2
2 2
-1
2 2
-1
2 2
2 2
-1
2 2
2 2
2 2
-...

result:

ok ok (100000 test cases)

Test #3:

score: 0
Accepted
time: 47ms
memory: 3764kb

input:

25000
10 5
4 10
1 4
9 9
2 9
5 8
1 8
1 5
5 5
4 9
6 6
11 5
9 11
4 7
2 2
2 5
8 10
3 11
2 4
4 8
3 10
4 6
5 2
1 3
4 4
1 5
5 5
6 3
4 6
3 3
1 5
3 6
1 1
1 3
7 3
4 4
3 5
1 6
3 4
2 3
1 2
7 3
3 4
1 5
6 7
2 6
3 5
2 3
5 2
5 5
4 5
2 3
1 1
10 5
3 6
4 5
3 3
6 9
2 5
9 10
5 6
5 7
1 4
8 9
11 5
1 10
2 11
6 9
2 6
6 6
8 ...

output:

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

result:

ok ok (25000 test cases)

Test #4:

score: 0
Accepted
time: 59ms
memory: 3804kb

input:

10000
22 11
2 5
6 9
11 22
10 18
15 19
6 19
6 15
8 13
2 13
8 18
13 17
10 12
3 11
11 18
12 17
13 18
7 8
17 18
11 15
5 15
5 20
18 19
23 11
10 21
1 10
4 21
15 21
12 21
2 14
7 15
2 6
6 15
2 22
1 21
12 13
2 10
11 19
4 22
10 10
7 12
5 17
11 22
22 22
3 12
5 9
18 9
4 12
12 12
4 18
1 13
8 10
3 4
7 15
2 12
17 ...

output:

1 15 11 4 15 9 13 13 9 10 11 12 13 14 15 16 17 18 19 20 21 22
10 6 12 21 9 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
8 12 12 12 5 12 7 8 9 10 11 12 13 14 15 16 17 18
18 14 18 14 10 15 17 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
13 23 13 16 16 6 12 12 9 21 11 12 13 14 15 16 17 18 19 20 21 2...

result:

ok ok (10000 test cases)

Test #5:

score: 0
Accepted
time: 45ms
memory: 3516kb

input:

5000
36 18
9 14
2 17
8 32
3 32
15 24
14 29
9 20
24 27
22 36
4 9
24 28
16 34
5 33
31 35
13 33
2 32
5 31
22 29
25 31
26 31
7 7
11 11
7 15
2 4
2 3
21 34
26 35
6 20
1 10
2 35
7 24
1 27
1 18
9 13
4 34
10 11
56 28
24 29
22 37
41 43
36 56
25 45
26 54
3 28
14 29
11 18
1 6
7 50
5 27
3 3
41 46
38 38
47 52
6 1...

output:

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

result:

ok ok (5000 test cases)

Test #6:

score: 0
Accepted
time: 42ms
memory: 3576kb

input:

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

output:

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

result:

ok ok (4000 test cases)

Test #7:

score: 0
Accepted
time: 45ms
memory: 3524kb

input:

3000
65 32
38 46
59 65
18 19
50 54
15 20
31 35
38 61
12 65
17 36
17 23
19 57
58 60
1 54
14 47
52 60
9 46
38 53
34 49
16 60
6 40
47 51
33 45
2 35
8 11
14 15
16 30
11 61
21 40
30 30
15 50
23 34
27 38
21 28
36 37
4 51
47 53
26 37
15 52
41 52
56 65
1 32
60 61
62 65
25 33
36 45
1 7
38 43
55 62
2 42
10 25...

output:

7 35 3 51 65 57 7 61 46 25 61 65 13 20 20 30 23 57 57 20 28 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
22 25 46 69 51 27 69 36 36 35 25 53 24 53 25 25 17 36 50 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 ...

result:

ok ok (3000 test cases)

Test #8:

score: 0
Accepted
time: 55ms
memory: 5624kb

input:

2000
96 48
62 74
45 59
40 76
15 46
3 82
31 48
31 94
66 91
77 96
53 80
9 65
3 4
5 78
28 34
7 55
23 51
4 61
4 57
36 86
59 68
89 94
47 67
53 74
48 60
53 91
39 95
18 60
50 88
7 75
87 90
8 44
22 63
58 85
12 68
37 90
3 26
18 50
86 94
62 88
50 54
59 61
91 93
17 32
63 80
40 44
5 95
45 91
49 91
36 53
30 36
4...

output:

78 82 33 33 78 56 55 44 59 71 26 68 35 14 46 68 32 39 70 20 21 63 51 24 25 26 32 34 82 36 48 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
104 48 53 68...

result:

ok ok (2000 test cases)

Test #9:

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

input:

1500
147 73
5 92
4 46
113 113
14 113
54 126
17 36
83 94
99 110
55 69
24 97
20 82
43 91
131 137
22 115
96 97
3 83
51 96
73 123
40 71
79 137
25 135
49 60
4 44
74 124
114 141
39 115
9 48
83 112
11 46
80 139
37 125
8 59
43 136
122 124
111 115
85 131
35 89
75 129
16 19
27 77
82 118
19 137
17 109
82 101
3...

output:

64 2 33 44 52 6 80 59 87 10 64 12 13 113 15 63 64 60 63 82 21 113 135 118 135 26 67 28 95 118 90 59 33 58 89 64 83 89 115 71 60 122 91 44 70 46 47 87 60 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...

result:

ok ok (1500 test cases)

Test #10:

score: 0
Accepted
time: 55ms
memory: 3560kb

input:

1000
188 94
142 175
49 149
53 186
33 144
128 167
81 123
40 95
7 134
82 157
95 95
167 178
5 34
42 52
68 71
118 157
108 114
7 33
95 144
126 165
79 126
49 68
3 39
30 63
100 182
11 18
66 72
99 109
5 8
39 52
13 188
83 101
107 118
58 165
34 176
41 94
61 74
8 159
157 165
21 45
3 137
131 183
90 165
83 100
7...

output:

1 81 52 90 159 93 63 159 94 172 73 71 188 118 135 135 95 73 92 20 107 90 23 180 63 107 103 89 29 63 78 32 135 176 89 97 103 38 52 95 94 52 48 89 107 137 107 48 68 50 144 52 134 176 98 67 172 165 66 60 74 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 ...

result:

ok ok (1000 test cases)

Test #11:

score: 0
Accepted
time: 49ms
memory: 3528kb

input:

500
392 196
1 389
69 348
155 217
305 339
211 303
73 145
14 245
2 11
41 78
80 279
92 390
313 355
29 164
189 284
52 381
67 150
220 242
281 352
276 389
26 352
164 346
107 125
292 357
97 312
100 335
85 241
83 173
136 299
170 335
30 84
36 329
143 298
13 139
268 309
281 384
116 293
103 116
120 284
209 305...

output:

64 188 200 4 245 299 244 8 244 155 188 12 255 245 181 258 256 313 181 323 155 169 246 120 146 337 27 28 164 324 313 167 248 109 193 329 37 126 352 181 174 42 151 362 196 268 167 362 132 330 300 303 138 122 55 64 155 338 187 183 157 381 113 64 298 66 118 122 108 151 167 116 145 209 225 221 173 174 12...

result:

ok ok (500 test cases)

Test #12:

score: 0
Accepted
time: 42ms
memory: 5804kb

input:

41902
4 1
1 4
1 1
2 1
1 2
2 2
4 2
2 2
1 4
3 3
1 3
3 2
1 2
2 2
1 1
3 3
3 1
3 3
1 2
3 1
1 1
2 2
2 1
1 1
2 2
3 1
1 1
1 2
2 1
2 2
1 1
5 7
5 5
1 1
3 5
1 2
2 3
2 2
4 5
2 4
1 5
2 5
3 4
3 3
4 4
1 3
5 5
2 4
4 4
1 3
3 3
3 4
2 5
1 1
2 2
1 2
5 5
5 4
3 5
5 5
2 5
2 2
1 3
2 3
1 5
4 4
3 2
1 3
1 1
2 2
1 2
4 3
1 4
3 ...

output:

4 2 3 4
2 2
3 2 3 4
-1
2 2 3
-1
-1
2 2 3
-1
5 5 5 4 5
4 4 4 4 5
3 3 3 4 5
2 2 3
4 4 3 4
3 3 3 4 5
3 4 3 4 5
2 2
2 2
2 2
5 5 5 4 5
3 3 3
1 4 3 4
-1
2 2 3
5 5 3 4 5
4 4 3 4 5
3 3 3
2 2
1 4 3 4 5
3 3 3
-1
3 3 3
4 2 4 4 5
5 5 5 4 5
3 3 3 4 5
3 3 3
1 4 3 4
-1
2 2 3
-1
4 4 3 4
5 5 5 4 5
2 2
3 3 3 4
4 2 3 ...

result:

ok ok (41902 test cases)

Test #13:

score: 0
Accepted
time: 42ms
memory: 3520kb

input:

15702
9 7
1 4
3 6
4 4
4 5
7 8
1 1
4 9
5 7
1 8
3 4
5 6
6 6
7 9
1 7
7 13
4 5
1 7
2 5
6 7
1 4
1 3
4 4
1 1
1 2
2 4
5 6
4 7
3 6
2 7
2 2
3 7
5 7
3 3
6 6
2 6
3 4
4 6
5 5
1 5
1 6
2 3
4 2
3 4
2 2
2 3
2 4
8 14
5 7
1 6
4 6
1 3
8 8
1 1
5 8
2 6
3 3
3 7
2 2
6 6
6 7
4 8
6 8
4 5
3 8
1 2
5 6
3 5
5 5
4 7
1 5
7 7
2 4
...

output:

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

result:

ok ok (15702 test cases)

Test #14:

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

input:

4960
9 20
1 3
1 7
1 2
2 3
8 8
2 4
7 8
9 9
6 8
3 4
3 9
6 6
2 5
5 9
3 7
7 9
4 5
4 7
2 6
4 9
4 8
3 3
5 8
8 9
1 4
5 6
3 8
1 5
2 8
3 5
1 8
1 1
2 2
5 5
6 7
7 7
1 6
4 4
5 7
6 9
3 2
1 3
2 2
3 3
1 1
11 16
4 11
9 10
3 4
2 10
4 9
6 7
3 7
6 10
1 7
7 11
7 7
1 6
1 9
10 11
5 9
4 7
8 10
3 6
5 5
1 10
6 11
3 10
5 7
7...

output:

7 7 7 7 5 6 7 8 9
-1
9 9 9 9 5 6 7 8 9 10 11
10 10 10 10 5 6 7 8 9 10 11
8 8 8 4 5 6 7 8 9 10
2 2 3 5 5
2 2 3 4 5 6
3 3 3 4 5 6 7
5 5 8 4 5 6 7 8 9 10
6 6 6 4 5 6 7 8 9 10 11 12
17 17 17 17 17 17 17 8 9 10 11 12 13 14 15 16 17 18 19 20
5 2 5 8 5 6 7 8
-1
8 8 8 8 9 9 7 8 9 10 11 12 13 14 15 16 17
3 3...

result:

ok ok (4960 test cases)

Test #15:

score: 0
Accepted
time: 31ms
memory: 3572kb

input:

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

output:

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

result:

ok ok (871 test cases)

Test #16:

score: 0
Accepted
time: 36ms
memory: 3564kb

input:

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

output:

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

result:

ok ok (929 test cases)

Test #17:

score: 0
Accepted
time: 38ms
memory: 3692kb

input:

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

output:

28 28 28 28 28 28 28 28 28 28 28 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
6 6 6 6 5 6 7 8 9 10 11
19 25 22 4 28 6 31 8 11 29 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
21 21 21 21 21 21 21 21 21 21 21 12 13 14 ...

result:

ok ok (934 test cases)

Test #18:

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

input:

216
78 478
13 77
47 50
6 66
66 73
5 14
35 45
3 57
16 43
39 40
44 52
48 52
72 72
45 71
50 66
16 50
24 45
40 76
53 74
25 28
28 66
41 58
9 56
13 44
6 21
26 77
3 25
3 50
53 58
15 68
3 48
38 61
33 65
5 39
43 73
8 78
30 41
57 62
41 46
20 33
31 45
18 27
14 58
63 64
47 57
29 70
1 51
27 61
36 58
25 46
5 65
7...

output:

28 28 28 26 28 26 28 26 26 28 28 28 28 28 28 28 30 26 33 30 33 28 28 42 42 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 46 ...

result:

ok ok (216 test cases)

Test #19:

score: 0
Accepted
time: 38ms
memory: 5644kb

input:

243
10 19
3 7
1 6
4 10
4 8
5 8
1 9
2 5
3 9
3 3
1 5
5 10
2 10
3 4
3 6
5 9
2 2
2 6
4 7
6 6
4 9
7 7
3 5
7 9
3 8
5 5
6 8
2 9
1 7
4 5
7 8
7 10
1 8
9 9
2 8
2 7
1 2
3 10
8 8
87 218
19 76
44 64
22 42
29 51
12 46
15 17
65 68
8 37
32 42
13 83
21 51
18 86
8 41
21 36
34 82
5 78
52 74
29 56
12 76
52 63
20 67
66 ...

output:

5 5 4 4 5 6 7 8 9 10
28 28 39 39 39 28 28 28 28 28 39 39 39 28 28 41 28 34 28 35 28 28 35 33 47 30 56 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
23 19 19 23 23 19 ...

result:

ok ok (243 test cases)

Test #20:

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

input:

207
49 111
29 35
17 17
6 31
3 30
38 41
22 30
8 41
5 20
6 16
31 34
24 36
11 19
16 38
7 35
30 35
14 36
13 30
14 45
30 42
23 38
1 6
6 42
36 46
15 47
30 47
8 45
22 48
42 46
2 31
6 12
24 49
4 42
2 10
29 30
14 18
6 27
30 48
36 36
8 47
12 41
4 43
1 22
18 23
6 26
25 41
4 27
7 32
9 20
35 48
11 38
11 39
7 48
...

output:

15 15 15 15 18 15 20 20 20 15 15 15 20 20 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
33 30 33 4 25 30 25 22 25 33 25 30 30 21 24 25 33 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
32 32 32 32 32 32 3...

result:

ok ok (207 test cases)

Test #21:

score: 0
Accepted
time: 45ms
memory: 3672kb

input:

66
164 5146
112 153
31 50
121 160
112 149
34 101
46 59
46 118
71 151
42 157
99 153
9 11
58 83
34 89
5 155
102 153
56 157
83 104
83 87
7 77
43 137
40 152
36 47
65 104
43 110
4 68
56 134
11 130
130 159
1 108
44 158
16 78
68 91
12 135
35 120
41 146
85 152
95 120
106 132
27 119
16 88
46 111
17 138
30 82...

output:

94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 94 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

result:

ok ok (66 test cases)

Test #22:

score: 0
Accepted
time: 36ms
memory: 4052kb

input:

26
259 10209
140 162
33 206
18 209
102 147
159 256
138 143
117 257
19 217
70 247
81 215
74 171
24 76
56 167
63 79
146 202
183 203
1 119
95 131
192 194
181 205
39 235
118 158
184 204
116 130
102 214
94 183
36 170
73 120
13 16
17 76
37 96
65 86
72 109
36 249
6 210
25 41
71 91
18 149
66 110
186 222
27 ...

output:

79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 79 97 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

result:

ok ok (26 test cases)

Test #23:

score: 0
Accepted
time: 44ms
memory: 4028kb

input:

15
110 874
86 90
38 53
36 71
95 108
13 95
24 38
6 57
9 32
48 71
60 87
36 99
79 84
3 40
1 18
25 98
72 102
26 43
56 98
5 15
13 27
17 25
22 27
58 64
85 89
58 88
5 11
2 34
62 69
109 109
49 99
28 39
4 49
20 105
43 53
25 45
25 96
1 22
40 57
1 103
34 42
39 97
23 69
49 65
30 81
14 27
41 86
17 78
58 100
83 8...

output:

86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 86 36 86 36 36 36 34 51 86 86 34 86 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100...

result:

ok ok (15 test cases)

Test #24:

score: 0
Accepted
time: 43ms
memory: 3908kb

input:

13
216 4476
108 125
45 173
117 126
95 127
157 199
128 167
119 216
53 93
67 214
38 58
19 25
14 135
114 171
29 48
4 143
43 199
22 74
98 211
31 106
106 140
26 204
14 199
158 167
65 186
123 152
80 203
182 216
78 139
47 176
162 204
11 95
83 197
58 69
138 184
1 59
186 191
105 173
48 97
35 109
45 64
124 13...

output:

66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 65 65 65 66 65 66 66 171 65 171 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1...

result:

ok ok (13 test cases)

Test #25:

score: 0
Accepted
time: 83ms
memory: 5912kb

input:

1
200000 100000
5435 51605
65565 190063
140607 193643
31380 45537
3961 55383
25625 38764
27570 135633
35840 167150
126881 193680
19261 139009
110761 185612
25060 168287
23579 129939
31514 88726
127835 171458
48657 82850
19153 176202
117009 136283
38162 106216
70625 130422
56502 121622
86260 142727
3...

output:

71885 151473 66326 166509 59379 58137 7 3397 60496 10 113941 59973 103177 112717 69988 154866 69314 74364 83515 157698 99699 75426 88876 151774 160235 94505 131880 96782 161781 103502 67946 32 33 61148 99137 125936 126358 42300 39 128599 68071 89363 43205 172653 170163 110536 47 8315 131436 61691 13...

result:

ok ok (1 test case)

Test #26:

score: 0
Accepted
time: 70ms
memory: 5896kb

input:

1
199921 99985
103056 143610
165590 191047
63600 63838
123160 188419
104260 147276
112410 185579
2700 179127
78472 164457
114801 145423
191999 196291
90822 177869
51896 145573
74782 131827
160438 167805
52443 141624
146562 158836
70400 119165
115232 127784
24895 47913
128942 175540
40145 41946
93417...

output:

122064 2 125028 4 5 197128 7 94944 147077 77166 91653 12 182127 33632 15 99623 17 98434 67072 81475 98369 60518 146239 147733 75380 18767 96909 49158 29 49925 129021 32 73101 196439 46280 112741 60687 38 130315 43614 73565 42 43 44 119098 81363 98662 83078 49 50 51 96644 72440 76522 42788 139332 164...

result:

ok ok (1 test case)

Test #27:

score: 0
Accepted
time: 66ms
memory: 5888kb

input:

1
199907 99603
84324 152188
68856 157591
918 87087
86133 120796
44517 106591
79065 142117
75031 153216
194825 196384
67470 114247
19127 140381
51212 197585
132561 171506
59403 177050
137553 195682
135941 146610
45358 57782
2628 161890
71022 189271
34370 86323
19542 108262
38970 59100
116781 122224
1...

output:

1 96014 57323 95893 5 82397 52670 35276 65851 67767 118326 55869 88434 77762 104706 16 93604 73213 19 154316 69750 1259 23 186342 133963 97007 190140 85227 29 30 74894 103789 65233 74822 74501 162339 62767 119754 39 91194 87521 80863 60250 146274 80690 188505 158667 65140 179963 184707 153789 34936 ...

result:

ok ok (1 test case)

Test #28:

score: 0
Accepted
time: 107ms
memory: 5852kb

input:

1
199187 99820
148565 160009
140518 171681
75059 140113
40970 117651
46813 120478
41658 177438
126700 183863
89947 152361
35812 121754
129088 186431
98884 159523
43327 99423
58054 151417
125288 173885
6257 78052
132171 180569
103064 111103
103720 117210
12343 66848
30679 96271
89720 162883
28897 191...

output:

104148 2 194441 63162 72048 114349 71503 96722 76547 67777 169540 167555 13 138316 180494 16 97206 124365 62341 114097 159130 149804 91518 159832 180518 155948 155306 148851 74664 121741 197274 42302 104328 173157 175498 62151 164434 146717 39 135162 122580 135553 85122 44 131318 124605 117101 94768...

result:

ok ok (1 test case)

Test #29:

score: 0
Accepted
time: 72ms
memory: 5852kb

input:

1
199402 99528
59883 73211
154329 197322
106362 122643
148179 186347
5919 101638
181550 189040
30498 86234
18736 98684
5528 113409
55716 187444
18658 125497
51054 165466
21111 86450
6115 67650
22324 149626
73894 129025
11036 170928
84030 147342
183697 192954
96225 165374
165196 169809
40552 58094
47...

output:

34605 144021 37128 120844 82782 172490 24313 63723 56943 77749 105291 117421 68998 51139 94654 81503 39968 132340 19 117404 88792 22 106857 61097 92283 2968 120574 66925 115625 31100 107055 77215 27143 72807 35 162441 84680 38 39 134221 161383 59927 87541 115125 90463 46 79974 107972 49 139159 70106...

result:

ok ok (1 test case)

Test #30:

score: 0
Accepted
time: 61ms
memory: 5852kb

input:

1
199604 99546
176159 191086
138429 181944
67569 198623
35297 177657
22993 62162
68546 193414
100380 161830
112597 133247
114577 121122
80178 84189
17707 42100
211 56675
18930 116076
170214 176911
88756 115840
85121 93430
1538 194211
5297 194826
12331 139371
98205 110997
3333 56340
11700 96402
45656...

output:

5867 170252 109606 90378 109279 126895 137837 100380 112258 17386 43558 120327 29527 14 60137 16 85486 61802 67936 62408 21 84251 170088 24 20727 107232 62972 126914 69693 127786 105166 125074 139938 96743 106668 60017 58804 95708 127983 95841 105978 61754 81379 152241 36333 88553 175842 48 15244 50...

result:

ok ok (1 test case)

Test #31:

score: 0
Accepted
time: 65ms
memory: 6024kb

input:

1
199489 99617
23664 52627
108617 138959
4229 100223
176064 196597
143559 163730
103535 151443
53554 196500
105472 158006
154506 190393
6693 54536
26379 105288
121437 171819
105401 197780
38110 152169
129376 134448
193185 199074
42992 61557
8706 29384
296 109525
55956 97934
40004 43964
88870 178390
...

output:

145366 44171 97369 132377 128581 63631 7 169134 9 98903 188882 112215 120058 14 41406 194771 62885 71175 79595 101209 48770 97145 141711 24 63041 142548 111470 28 107469 73999 162498 169254 102365 72123 66899 151277 91181 113211 81022 133352 134018 113358 16712 66193 187325 138727 184957 158509 1047...

result:

ok ok (1 test case)

Test #32:

score: 0
Accepted
time: 75ms
memory: 6092kb

input:

1
199705 99899
113902 138967
68937 86292
147460 190982
79047 160599
98906 168949
42987 184473
62758 124862
4375 43060
26883 73218
110548 143921
37414 51392
94630 101673
87850 122341
153060 187310
3981 89322
76857 177304
41266 79671
11196 188361
59146 125009
93905 191774
33636 74651
114150 156609
141...

output:

87109 63089 70399 119505 116058 152492 57493 137108 69977 31636 131988 127333 13 102080 92759 129717 187368 18 83891 20 108326 58786 145059 108483 113262 61193 122294 178289 68472 14405 126802 183987 143695 69105 72711 76239 72561 92674 190226 38078 79660 103017 94099 116239 72312 140407 21597 14015...

result:

ok ok (1 test case)

Test #33:

score: 0
Accepted
time: 70ms
memory: 6124kb

input:

1
199352 99733
37917 173133
73254 154287
2180 130392
53939 184382
95721 125269
18990 93274
175898 182797
24516 148454
164014 182201
56926 133290
39103 102519
77598 126847
35976 105611
101372 185172
24212 41991
28068 62504
44141 145704
38850 144703
5078 190440
37230 88435
90584 149922
601 191977
7793...

output:

105123 74727 156101 128137 5 63903 159160 8 9 83880 11 134760 90682 70453 35873 30385 83661 59956 73745 71131 21 100850 181989 78449 90981 26 49041 28 67579 85407 108896 72767 108888 5541 153286 101370 141171 167469 71065 40 102627 165342 59206 44 45 149608 194703 157654 49 50 32141 108763 145166 78...

result:

ok ok (1 test case)

Test #34:

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

input:

1
199338 99971
17165 87851
23818 121851
4100 166900
91756 190077
78693 113537
14532 180577
11424 48656
40803 117414
32918 34131
122396 186203
134844 185967
79253 153593
116943 178384
7639 9185
132251 134894
88424 118015
168090 177027
187304 198306
49999 50358
97318 159339
16055 130932
145439 171551
...

output:

76285 72183 3 66166 89227 124056 107993 8 87916 10 86893 65942 147371 75460 124304 97538 166144 94875 19 106572 151098 79628 116628 107432 99557 147081 72080 28 149521 128121 71142 32660 33 38089 137668 87722 105816 125989 72036 78909 154423 68028 182815 165957 109704 29510 106455 83493 3495 64726 6...

result:

ok ok (1 test case)

Test #35:

score: 0
Accepted
time: 62ms
memory: 6124kb

input:

1
199439 99823
81809 140926
23811 147090
191848 197185
132851 198467
66372 148259
64416 183635
74793 174015
75536 109314
28933 41402
69571 183777
125547 157788
23864 130276
66590 149298
85462 129801
122032 128546
18807 166479
155391 195550
31785 66555
133607 186674
2581 56107
60668 187154
80341 1213...

output:

183230 2 189054 113381 5 6 74141 87528 108907 100133 94713 63673 141944 129338 43411 75692 150889 18 29000 63652 21 97057 60674 24 110540 171078 90705 28 72973 30 62596 92058 165833 126946 168206 99014 61948 61268 172705 40 100859 48205 113204 170823 74208 115874 195511 50709 82170 101260 51 80155 8...

result:

ok ok (1 test case)

Test #36:

score: 0
Accepted
time: 67ms
memory: 4928kb

input:

2
99794 49897
8477 62498
65109 96477
42995 72444
28517 55936
67876 87225
20851 53210
53382 82592
40295 71977
27761 47307
37822 82660
19497 42096
3437 26217
31268 47871
85339 98140
64736 97501
20135 40750
3912 44208
22007 33971
31186 63013
18250 43277
39789 56149
56163 62346
54231 92269
88417 90929
5...

output:

34542 30200 74571 41011 60552 34302 61454 37727 13885 83829 41138 85539 43359 68569 73777 36110 8631 94635 34931 61491 92990 33632 66493 56606 25 39051 27 32037 99249 34869 13190 85861 33271 50751 34204 36241 12769 81689 39 35785 47401 84907 25749 81808 46278 58575 50616 75339 39975 82202 30876 4730...

result:

ok ok (2 test cases)

Test #37:

score: 0
Accepted
time: 65ms
memory: 4308kb

input:

3
66379 33189
5835 24165
19013 36047
30577 60062
11987 54246
38178 42807
22994 43449
28778 34300
30361 52843
28455 48046
900 6313
46437 47397
49432 55850
12602 41914
15221 65055
19672 20399
10357 64969
42367 62359
35447 61268
12946 47406
27260 40030
8484 15954
19705 39317
47257 47284
5051 57992
4915...

output:

38554 63620 3 20730 30028 39670 33100 43253 27702 10 1311 59187 60188 14 36170 50486 26678 40298 52334 34205 55297 40015 42258 11247 29544 36545 29485 53765 56958 13235 22343 20778 42200 1491 28865 37932 23679 262 52241 39534 40316 42 43282 59234 34501 58916 34990 19814 24742 22145 22297 27496 33535...

result:

ok ok (3 test cases)

Test #38:

score: 0
Accepted
time: 55ms
memory: 3992kb

input:

5
39514 19757
20458 28522
9917 17067
12908 15800
2845 4335
1704 33971
6247 7629
8075 18756
5525 37316
3627 27109
19324 33336
37991 38073
1914 16272
5429 14867
14743 28082
15639 17009
21773 31519
14282 23955
22555 33113
285 34627
23239 34179
6626 18400
7685 12193
23764 26880
10510 18607
8649 16792
27...

output:

29691 2 12096 4 21513 22612 15424 16488 21790 30151 12550 23159 15078 15141 29139 16 8134 8833 12324 14948 24141 20849 9412 24 21880 22467 13951 28 28557 16923 31 35239 29797 26090 18930 19814 15241 24865 39 33971 17164 12734 32247 14978 9403 11070 27342 23723 20056 50 28616 12291 53 21205 55 56 118...

result:

ok ok (5 test cases)

Test #39:

score: 0
Accepted
time: 38ms
memory: 3796kb

input:

10
20098 10049
1332 9929
8348 16079
808 19476
577 19504
3976 17301
4195 15617
800 15096
1019 17128
13858 15961
1881 14465
278 4823
27 10577
18474 18645
6748 9234
4185 4551
8192 16755
2268 5542
4444 10026
13412 18514
2812 9565
15843 16720
13137 18526
1693 9391
8464 14783
1660 10294
8725 16273
2247 14...

output:

11119 2 15459 4 9729 11700 7 13687 1550 6720 12175 9138 7491 4099 12984 16136 18508 9243 5810 20 8905 8531 16712 24 25 5799 7042 8048 8785 8425 16724 10936 9018 10619 8209 15604 6179 7812 9327 7784 41 11530 9668 10234 6949 17489 5037 7263 7100 9246 15061 11623 7873 4540 10986 19428 11255 4718 7944 6...

result:

ok ok (10 test cases)

Test #40:

score: 0
Accepted
time: 46ms
memory: 3640kb

input:

20
10036 5018
9524 9978
881 7972
5874 9777
497 3608
1863 2806
4961 7511
4658 7600
3147 5840
5094 6027
5128 7282
160 6636
3363 7901
2537 9233
5573 5935
1301 9675
1826 5759
7871 9773
2156 3439
785 9043
4659 4795
2645 7779
1214 9464
4806 10015
3945 7258
3803 6147
1117 5744
4040 8735
4625 8249
2209 6769...

output:

7487 3745 2207 3113 5925 4800 2914 3997 9 793 6604 12 5768 5408 793 4003 17 1580 5413 1848 3516 4516 3842 2658 8766 4843 8125 4672 3690 9057 4754 7412 9741 34 5490 5042 37 5585 7968 5081 969 42 7103 4028 5696 1400 3563 6277 4503 5628 5813 9033 4800 4168 5196 8559 3410 142 442 7349 4394 4212 6919 886...

result:

ok ok (20 test cases)

Test #41:

score: 0
Accepted
time: 56ms
memory: 5632kb

input:

50
4025 2012
1477 1545
503 648
387 3828
1927 3525
256 461
3276 3977
649 798
1698 1983
3 1101
2051 2223
3760 3828
3030 3686
2700 3054
575 1587
1010 2434
213 2977
46 3639
1193 3022
2649 3233
772 2064
901 3288
1319 2699
877 1348
2408 3698
192 545
214 3568
3809 4013
1188 1829
1994 3697
1930 2736
1511 35...

output:

2630 2290 1079 2551 3058 3513 1102 380 1445 1241 497 3102 3506 2894 1365 174 2773 3856 3443 632 21 816 3897 54 3671 1495 2419 2478 29 3274 31 1327 1692 2099 3692 2348 1810 38 3457 1744 2090 2893 2825 2269 2948 2630 1246 48 49 380 130 2883 3470 54 1249 2883 57 1699 3776 607 2410 2438 3443 3280 3641 2...

result:

ok ok (50 test cases)

Test #42:

score: 0
Accepted
time: 56ms
memory: 3708kb

input:

100
1980 990
985 1741
981 1754
531 1058
995 1488
375 1042
26 874
1031 1659
667 1619
1673 1898
974 1830
116 1044
11 926
272 1267
516 784
717 824
107 1978
437 981
1148 1351
298 708
1226 1293
1268 1932
945 1571
1002 1229
70 1066
511 1868
584 1221
1504 1812
1158 1796
562 774
587 1026
1773 1926
426 595
3...

output:

505 1846 3 4 1507 605 7 1762 1067 846 926 12 121 14 605 849 754 573 19 1517 21 775 176 605 790 874 1358 1633 29 1917 460 101 33 626 1286 37 37 1797 1228 1231 1189 1022 1297 561 1246 1274 833 1067 625 626 799 1305 539 717 1362 1447 886 689 59 1681 61 1809 977 986 65 861 67 1322 69 1066 801 1218 73 46...

result:

ok ok (100 test cases)

Test #43:

score: 0
Accepted
time: 51ms
memory: 3820kb

input:

200
988 494
682 908
368 485
227 596
311 808
354 763
354 953
664 848
674 734
730 897
76 733
366 968
313 666
311 700
132 567
268 766
180 806
622 712
442 966
1 664
709 739
291 943
672 906
230 290
200 934
40 84
534 675
147 701
425 656
638 795
955 973
267 900
254 747
463 737
234 742
600 805
57 606
65 562...

output:

211 283 496 830 487 6 300 560 512 627 560 12 591 571 505 397 375 500 505 567 420 575 873 287 565 438 485 283 117 804 836 681 779 812 774 36 804 355 324 375 750 575 521 521 284 300 290 48 290 289 370 466 543 971 639 632 257 58 611 901 771 704 361 779 542 257 373 594 69 279 720 128 414 668 886 293 591...

result:

ok ok (200 test cases)

Test #44:

score: 0
Accepted
time: 30ms
memory: 3624kb

input:

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

output:

-1
-1
1 2 25 4 16 25 14 8 13 10 11 15 13 14 15 16 17 18 19 20 21 22 23 24 25
34 2 23 8 8 34 37 8 44 12 23 12 13 23 44 37 17 18 37 20 32 32 23 34 25 46 37 32 36 36 46 32 33 34 35 36 37 44 39 44 44 42 43 44 45 46 47
-1
11 5 11 4 5 6 15 19 9 21 11 12 13 14 15 18 17 18 19 20 21 22 23 24 25
-1
-1
-1
-1
1...

result:

ok ok (5599 test cases)

Test #45:

score: 0
Accepted
time: 32ms
memory: 3512kb

input:

3304
72 15
38 71
34 52
5 54
26 26
49 49
30 66
66 66
9 9
60 60
1 39
64 64
42 49
19 67
61 61
65 65
13 13
54 54
4 4
42 42
68 68
12 12
27 56
64 65
61 71
37 37
70 70
57 57
23 48
1 50
40 40
52 10
46 46
45 45
12 21
18 18
16 16
37 44
15 15
3 37
39 39
4 31
26 26
40 40
22 22
26 30
41 50
2 50
8 18
11 11
5 20
6...

output:

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

result:

ok ok (3304 test cases)

Test #46:

score: 0
Accepted
time: 45ms
memory: 3764kb

input:

781
150 60
4 130
28 91
57 97
1 150
8 24
24 126
94 94
37 65
134 134
107 107
79 147
68 68
97 97
50 50
21 104
136 136
81 81
74 137
114 114
53 53
16 16
105 132
112 112
9 24
109 109
15 15
101 101
132 132
115 115
81 93
73 75
26 132
71 133
12 12
75 75
1 47
4 4
93 93
99 99
54 103
54 54
102 150
35 136
91 91
...

output:

-1
-1
54 10 3 52 82 82 7 8 9 10 11 74 66 14 44 82 81 18 19 52 21 22 23 24 25 26 27 28 66 30 31 32 33 82 35 36 37 52 39 40 41 66 43 44 45 46 47 82 49 50 87 52 54 54 55 75 57 79 59 60 61 62 63 64 65 66 67 68 73 70 71 72 73 74 75 84 77 78 79 80 81 82 83 84 85 86 87 88 89
-1
185 235 193 196 5 6 303 276 ...

result:

ok ok (781 test cases)

Test #47:

score: 0
Accepted
time: 51ms
memory: 3592kb

input:

735
90 62
39 76
56 77
9 9
11 57
3 72
55 89
36 50
24 63
19 34
27 64
19 19
46 48
43 43
61 61
7 87
77 77
63 63
21 75
22 44
4 4
23 32
25 25
47 47
68 89
2 24
53 53
6 6
1 38
49 89
73 73
50 50
71 74
88 88
84 84
22 22
78 78
36 63
38 90
26 48
35 57
23 34
23 63
21 73
70 70
2 2
46 46
72 72
83 83
60 60
18 18
30...

output:

90 50 63 4 32 53 63 37 9 44 57 12 13 48 15 28 44 18 72 37 86 44 32 50 25 48 45 28 37 72 31 32 72 72 57 50 37 90 76 40 41 42 72 44 45 48 47 48 89 50 51 52 53 54 74 77 57 58 90 62 61 62 63 64 82 72 67 89 69 70 74 72 86 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
1 176 3 4 5 176 7 8 164 10 11 15...

result:

ok ok (735 test cases)

Test #48:

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

input:

777
140 5
55 104
89 118
41 41
89 120
103 120
15 15
118 128
8 8
91 91
100 100
311 190
197 197
259 259
61 283
243 243
230 230
184 207
160 160
157 173
55 55
307 307
31 31
68 68
72 72
92 246
6 6
15 255
281 281
231 231
279 279
77 77
52 52
211 211
129 129
80 80
184 213
131 182
70 70
248 248
38 111
180 180...

output:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 104 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 128 90 91 92 93 94 95 96 97 98 99 100 101 10...

result:

ok ok (777 test cases)

Test #49:

score: 0
Accepted
time: 49ms
memory: 3776kb

input:

385
885 358
589 589
399 767
363 363
295 683
134 134
395 395
404 411
658 658
56 880
384 384
419 747
186 186
41 41
277 277
137 137
349 349
467 467
35 304
638 817
274 274
724 724
153 710
214 317
186 450
60 60
104 153
475 475
93 823
257 401
593 825
176 869
649 818
557 557
34 34
530 814
79 79
395 639
216...

output:

323 2 3 791 602 6 817 825 9 338 252 785 13 133 451 16 710 394 19 394 21 22 23 397 25 819 436 264 29 30 31 32 33 34 725 819 37 38 39 595 41 42 43 367 45 46 219 868 49 50 51 52 541 603 565 880 57 758 189 507 705 659 63 64 65 516 261 68 880 786 308 351 258 74 75 76 858 819 79 80 715 199 83 624 85 410 8...

result:

ok ok (385 test cases)

Test #50:

score: 0
Accepted
time: 40ms
memory: 3888kb

input:

77
67 49
16 16
54 54
45 45
23 23
11 46
49 49
9 52
63 63
2 11
11 38
39 39
14 49
26 32
1 1
14 37
9 28
29 29
46 46
34 38
10 50
3 53
20 20
16 64
8 8
53 53
12 36
36 41
46 47
23 63
46 61
34 46
32 32
30 33
57 57
7 23
57 65
20 26
66 66
47 49
25 25
43 54
37 37
28 31
58 58
15 28
51 51
9 43
17 17
25 45
1 51
12...

output:

51 38 45 45 38 51 22 8 31 38 38 41 13 45 31 64 17 52 52 40 45 22 63 24 45 40 53 31 29 42 31 40 42 38 35 41 62 38 39 40 41 42 54 62 45 49 49 60 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
-1
-1
1 2 2996 4 5 3546 4728 8 3974 854 11 3656 13 14 15 16 17 1099 19 20 21 4797 23 2988 25 26 27 3...

result:

ok ok (77 test cases)

Test #51:

score: 0
Accepted
time: 57ms
memory: 3948kb

input:

42
4196 2994
2492 2492
390 2511
1498 2024
2164 2164
2161 3537
421 421
1680 1680
2484 2484
830 830
714 714
468 468
3662 3662
3181 3181
2192 3103
2433 2433
2284 2284
1074 3167
1431 2085
149 1169
3311 3625
3537 3642
303 375
3440 3440
2304 2304
3169 3169
1408 1654
1298 3334
590 3149
1181 2797
3244 3244
...

output:

-1
224 4385 3688 1474 4704 4645 3202 8 3211 1973 4481 1869 4302 4582 307 16 3780 1289 4557 3608 3013 2509 4086 24 3780 1102 2154 1678 4953 1597 2662 4422 3974 34 3681 3116 4402 38 39 4819 41 842 1412 44 4531 4900 47 4083 777 50 3519 52 3191 3519 4726 693 2662 58 4146 60 4760 1525 1807 1566 4601 4337...

result:

ok ok (42 test cases)

Test #52:

score: 0
Accepted
time: 61ms
memory: 4456kb

input:

8
41132 33063
5727 6723
16545 18518
7000 23858
21316 34695
4680 13234
1682 18038
9800 23791
39338 39338
16193 16193
1219 11844
10294 25003
718 11746
23967 31763
19416 19416
15762 29909
29565 37798
27394 27394
16073 16073
5862 5862
14541 14541
10027 24193
215 367
19677 19677
998 24535
9587 9587
11322...

output:

-1
1 2 3 4 5 6 6009 8 9 10 11 12 13 14 15 16 17 18 19 20 4480 6082 23 2213 25 26 5958 28 3798 1413 31 32 33 34 35 36 37 38 39 40 41 42 43 6139 45 46 47 48 49 50 51 6405 53 54 55 56 57 58 59 60 6110 6972 63 64 65 66 67 68 69 70 71 2795 73 74 75 270 77 6788 79 1322 81 82 83 84 6247 86 87 88 89 90 91 8...

result:

ok ok (8 test cases)