QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#577667#9301. Skeleton Dynamizationrotcar07AC ✓256ms36996kbC++202.2kb2024-09-20 13:53:432024-09-20 13:53:43

Judging History

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

  • [2024-09-20 13:53:43]
  • 评测
  • 测评结果:AC
  • 用时:256ms
  • 内存:36996kb
  • [2024-09-20 13:53:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int maxn=2e5+5;
int n,m;
vector<int> e[maxn];
int ans=1;
int col[maxn],ffa[maxn];
vector<int> res[maxn];
int dep[maxn],fa[maxn],co[maxn];
unordered_set<int> s[maxn];
void solve(int u,int v){
	memset(dep,0,sizeof dep);
	memset(co,0,sizeof co);
	memset(fa,0,sizeof fa);
	queue<int> q1,q2;
	dep[u]=dep[v]=1;fa[v]=fa[u]=1;q1.push(u),q2.push(v);
	co[u]=1,co[v]=2;
	int tot=1;
	vector<int> cur;
	while(!q2.empty()){
		while(!q1.empty()&&dep[q1.front()]<dep[q2.front()]){
			int p=q1.front();q1.pop();
			for(auto x:e[p]) if(!dep[x]) dep[x]=dep[p]+1,co[x]=1,fa[x]=++tot,q1.push(x);
		}
		int p=q2.front();q2.pop();for(auto x:e[p])if(co[x]==1&&dep[x]==dep[p]) fa[p]=fa[x];
		if(!fa[p]){dep[p]=co[p]=0;continue;}
		cur.push_back(p);
		for(auto x:e[p]) if(!dep[x]) dep[x]=dep[p]+1,co[x]=2,q2.push(x);
	}
	int w=cur.size();
	if(n%w||n/w<=ans||w!=tot) return;
	for(int i=1;i<=w;i++) s[i].clear();
	for(int i=1;i<=n;i++) if(co[i]==1) for(auto x:e[i]) if(co[x]==1) s[fa[i]].insert(fa[x]),s[fa[x]].insert(fa[i]);
	int lay=n/w;
	for(int i=3;i<=lay;i++){
		vector<int> tmp;
		for(auto x:cur){
			int cnt=0;
			for(auto y:e[x])if(!co[y]){
				cnt++;
				co[y]=i;fa[y]=fa[x];
				tmp.push_back(y);
				break;
			}
			if(!cnt) return;
		}
		swap(tmp,cur);
	}
	for(int i=1;i<=n;i++){
		int C=co[i],F=fa[i];
		if(!C||!F) return;
		bool prl=(C==1),nxl=(C==lay);int cnt=0;
		for(auto x:e[i]){
			if(fa[x]==F){
				if(co[x]==C-1) prl=1;
				else if(co[x]==C+1) nxl=1;
				else return;
			}
			else if(co[x]==C){
				int ff=fa[x];
				if(s[F].count(ff)) cnt++;
				else return;
			}
			else return;
		}
		if(prl&&nxl&&cnt==s[fa[i]].size());
		else return;
	}
	ans=lay;
	for(int i=1;i<=n;i++) col[i]=co[i],ffa[i]=fa[i];
}
int main(){
	cin>>n>>m;
	for(int i=1,u,v;i<=m;i++) cin>>u>>v,e[u].push_back(v),e[v].push_back(u);
	int z=1;
	for(int i=1;i<=n;i++) col[i]=1,ffa[i]=i;
	for(int i=1;i<=n;i++) if(e[z].size()>e[i].size()) z=i;
	for(int i:e[z]) solve(z,i);
	cout<<ans<<' '<<n/ans<<'\n';
	for(int i=1;i<=ans;i++) res[i].resize(n/ans);
	for(int i=1;i<=n;i++) res[col[i]][ffa[i]-1]=i;
	for(int i=1;i<=ans;i++){
		for(auto x:res[i]) cout<<x<<' ';
		cout<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 17648kb

input:

12 20
5 12
6 10
8 1
11 3
5 1
12 4
12 2
11 8
2 8
6 4
7 11
9 1
8 10
9 6
4 1
2 5
10 3
7 2
8 4
9 10

output:

3 4
3 10 6 9 
11 8 4 1 
7 2 12 5 

result:

ok correct, length=3

Test #2:

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

input:

3 3
1 2
2 3
3 1

output:

1 3
1 2 3 

result:

ok correct, length=1

Test #3:

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

input:

4 3
1 2
2 3
4 3

output:

4 1
1 
2 
3 
4 

result:

ok correct, length=4

Test #4:

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

input:

14 22
1 2
2 3
3 4
4 5
5 1
6 7
7 8
8 9
9 10
10 6
11 12
11 13
11 14
12 13
12 14
13 14
1 6
2 7
3 8
4 9
5 10
6 11

output:

1 14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 

result:

ok correct, length=1

Test #5:

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

input:

1 0

output:

1 1
1 

result:

ok correct, length=1

Test #6:

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

input:

4 4
1 4
2 1
4 3
2 3

output:

2 2
1 2 
4 3 

result:

ok correct, length=2

Test #7:

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

input:

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

output:

2 3
1 6 4 
2 3 5 

result:

ok correct, length=2

Test #8:

score: 0
Accepted
time: 6ms
memory: 20576kb

input:

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

output:

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

result:

ok correct, length=2

Test #9:

score: 0
Accepted
time: 6ms
memory: 17312kb

input:

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

output:

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

result:

ok correct, length=2

Test #10:

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

input:

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

output:

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

result:

ok correct, length=2

Test #11:

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

input:

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

output:

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

result:

ok correct, length=2

Test #12:

score: 0
Accepted
time: 6ms
memory: 17052kb

input:

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

output:

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

result:

ok correct, length=2

Test #13:

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

input:

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

output:

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

result:

ok correct, length=1

Test #14:

score: 0
Accepted
time: 6ms
memory: 20132kb

input:

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

output:

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

result:

ok correct, length=1

Test #15:

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

input:

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

output:

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

result:

ok correct, length=1

Test #16:

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

input:

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

output:

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

result:

ok correct, length=1

Test #17:

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

input:

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

output:

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

result:

ok correct, length=1

Test #18:

score: 0
Accepted
time: 6ms
memory: 20444kb

input:

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

output:

1 26
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 

result:

ok correct, length=1

Test #19:

score: 0
Accepted
time: 7ms
memory: 19876kb

input:

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

output:

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

result:

ok correct, length=2

Test #20:

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

input:

243 1215
67 149
227 161
27 51
206 68
106 137
213 44
31 61
46 194
209 143
52 19
217 125
132 102
105 192
216 4
205 147
194 84
60 73
155 33
67 157
123 160
121 46
61 205
210 94
88 197
226 15
145 60
130 114
184 58
218 95
37 134
71 43
217 140
103 214
180 120
84 212
213 93
198 171
208 154
231 68
181 111
12...

output:

1 243
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 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 10...

result:

ok correct, length=1

Test #21:

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

input:

162 729
10 36
75 50
36 78
76 52
62 128
23 134
132 49
89 30
111 114
18 71
46 114
128 111
111 159
19 6
83 121
55 12
44 95
106 91
99 50
69 24
40 42
60 103
35 61
28 91
5 29
89 122
78 104
1 113
17 31
22 11
8 34
6 74
43 2
27 132
15 72
81 105
143 78
53 74
5 45
85 130
119 42
67 100
78 90
35 161
156 90
130 1...

output:

2 81
1 113 99 47 57 143 26 134 10 126 94 156 44 13 155 50 116 11 28 111 56 141 34 23 22 114 95 137 89 17 48 97 82 77 102 153 103 119 150 138 39 63 69 135 27 75 91 42 29 128 86 159 16 30 8 147 106 38 85 122 2 151 25 31 4 76 124 21 60 125 84 88 24 45 133 5 160 33 64 118 52 
105 79 35 92 139 78 81 149 ...

result:

ok correct, length=2

Test #22:

score: 0
Accepted
time: 11ms
memory: 20908kb

input:

5000 19000
2567 320
3757 1281
4856 582
4786 3232
4651 3026
4746 2499
4931 1644
1110 4723
2227 4722
4238 3466
4060 489
3164 2664
2253 3356
3370 1202
774 1178
519 3400
3466 1920
3741 4356
4941 3301
4303 2327
2849 4580
4861 2289
4066 1954
4101 4187
4432 1149
3616 4873
2844 3801
3755 931
2089 689
4195 4...

output:

5 1000
2 4101 3289 1335 2861 2042 2251 4187 216 3109 3900 162 4628 245 1073 2907 4688 4259 1009 431 754 4076 2017 816 1472 3121 2263 1438 4352 4233 1392 416 1356 1464 1379 2857 4466 3687 1905 1624 2512 4734 4157 2150 875 423 2599 4686 2920 1780 4073 4251 2954 380 2307 1185 1918 2086 503 1582 1090 28...

result:

ok correct, length=5

Test #23:

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

input:

8 12
4 5
8 3
8 5
4 1
5 2
2 8
5 6
2 6
6 1
7 2
3 7
8 6

output:

1 8
1 2 3 4 5 6 7 8 

result:

ok correct, length=1

Test #24:

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

input:

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

output:

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

result:

ok correct, length=2

Test #25:

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

input:

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

output:

1 4
1 2 3 4 

result:

ok correct, length=1

Test #26:

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

input:

16384 114688
7724 15711
2622 11637
6678 12087
562 1017
1794 15380
2337 8273
3247 11939
4236 10764
10400 12609
11663 8529
15404 12196
16243 14355
10882 315
3181 8641
15945 2660
1752 6947
3241 3770
5914 5981
8688 6502
703 13187
9949 688
4183 2599
12150 5172
12263 2346
6910 14326
3030 3505
4874 10690
1...

output:

2 8192
1 13266 7560 5659 15037 9270 6106 4156 9574 9030 16070 12666 2578 14210 4581 1067 15827 10858 104 12831 15801 16005 9854 13755 3936 9770 15069 2584 8200 10935 16145 72 3490 8 6522 1723 14971 4772 7871 10913 10056 10030 11744 5656 16351 6849 12289 15124 4810 13464 2092 15812 9302 8960 9127 109...

result:

ok correct, length=2

Test #27:

score: 0
Accepted
time: 143ms
memory: 27100kb

input:

24576 176128
5861 17065
12716 19066
19 947
20854 119
117 16316
21260 20481
632 13339
1911 17818
498 23648
19585 12918
4065 5563
3896 8774
3090 15272
8077 13050
9473 16619
12008 23839
8790 17267
18509 5666
13923 16712
2046 1861
14627 12220
211 13045
18050 3452
14385 23112
5530 21387
9078 2343
5782 24...

output:

3 8192
1 9996 15123 8592 23884 6480 2085 2202 3464 3669 18051 23703 20318 11262 2651 22929 15214 23378 4711 8242 12544 292 19764 17001 17794 13786 17609 3288 3615 7068 18355 12188 11093 15024 20722 23037 16101 23575 1675 12532 9548 4272 10047 16848 9397 11400 18250 14403 10629 17048 2916 18062 8118 ...

result:

ok correct, length=3

Test #28:

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

input:

15120 81756
14074 2369
11398 3234
1596 12546
11639 1768
6042 6697
6885 1600
10471 227
9256 8330
4789 1806
188 11941
2491 7717
5831 2206
7386 1145
8491 12344
1209 14434
13997 11283
10996 4670
7429 9616
4658 10737
6224 4898
2041 9406
342 10047
4522 6993
12449 10459
11594 6930
8886 9023
12530 4847
1335...

output:

7 2160
51 7279 9722 2972 10201 959 6819 2443 921 9754 14858 5821 10975 10248 1198 1065 3093 13200 4184 3802 10885 1520 5447 14821 6553 12683 4815 12593 6331 968 6083 976 4192 4836 6276 5440 4609 14030 1484 8627 8519 9900 567 11613 14065 10490 10327 13232 15043 9798 7325 5143 7030 11226 11857 12240 5...

result:

ok correct, length=7

Test #29:

score: 0
Accepted
time: 110ms
memory: 23964kb

input:

99540 198449
89149 14835
33931 9990
57297 39659
96071 39113
74492 3118
68120 66797
73082 21160
74312 34410
23917 74499
31376 82735
87771 9229
52702 89517
36821 22952
80919 81907
46705 19871
50710 69762
17125 59407
32620 49896
78667 32781
16890 79230
27707 88410
62045 8145
39448 99401
71796 45195
796...

output:

316 315
20613 14052 22073 43473 27886 74676 4117 83116 11039 50060 75527 50884 34226 22095 45294 1926 52166 44594 17834 31446 42932 37603 78702 41458 38542 30680 74549 50855 74186 29132 47377 7889 32156 85001 42289 41445 65139 44876 12955 73360 63641 30508 85710 85695 94501 10157 57648 97882 16304 6...

result:

ok correct, length=316

Test #30:

score: 0
Accepted
time: 244ms
memory: 30844kb

input:

894 199809
342 637
407 892
346 203
423 357
787 622
875 153
305 428
759 894
744 247
386 685
886 750
615 66
94 628
124 223
590 854
559 106
287 357
384 352
258 378
574 517
748 213
82 732
353 334
373 211
28 236
319 233
737 636
776 392
39 386
610 279
22 709
764 470
667 833
677 259
462 340
468 136
750 728...

output:

2 447
1 891 732 595 878 150 394 335 320 244 58 451 280 349 753 841 209 231 846 216 867 223 38 741 815 893 573 455 365 210 796 63 59 154 121 401 554 800 136 83 688 590 894 96 553 550 389 126 133 124 446 769 129 207 494 327 545 31 823 634 496 655 368 693 51 186 700 619 254 66 834 34 155 265 380 728 73...

result:

ok correct, length=2

Test #31:

score: 0
Accepted
time: 256ms
memory: 23104kb

input:

632 199396
18 127
538 211
381 238
303 17
604 83
387 94
80 240
344 200
416 79
34 512
11 342
11 511
533 440
456 94
197 68
558 325
474 158
417 408
5 352
590 366
28 148
465 542
109 185
260 307
610 334
302 54
611 475
173 366
373 535
409 475
294 581
283 389
418 555
591 280
479 92
431 325
492 555
183 307
1...

output:

1 632
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 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 10...

result:

ok correct, length=1

Test #32:

score: 0
Accepted
time: 68ms
memory: 29860kb

input:

100000 99999
2312 22077
10466 32168
95585 98942
89965 92492
86014 22653
37128 86195
76539 12452
58590 23642
45443 26165
37638 78158
21985 71538
377 26988
94246 207
84743 82823
25753 34693
48157 64168
40378 91163
76721 51819
78106 50942
17725 12071
1185 73302
51666 41753
5644 61829
4882 59047
48810 9...

output:

100000 1
58410 
19619 
25075 
84339 
18280 
93895 
54571 
28024 
83571 
69924 
90463 
51253 
72778 
18929 
30347 
13121 
19370 
49013 
66419 
35383 
66062 
11489 
34845 
5453 
51328 
91881 
68212 
99650 
77472 
13139 
36784 
14547 
8252 
64355 
45683 
16839 
77098 
5626 
1005 
97806 
2701 
70749 
70...

result:

ok correct, length=100000

Test #33:

score: 0
Accepted
time: 102ms
memory: 26924kb

input:

99999 188878
64862 22873
22042 45992
9377 41645
69614 16413
33362 63451
7921 47032
72802 28650
17732 77545
68508 26424
16488 52052
51202 48881
83028 92497
56073 31680
34923 80417
12114 98352
3652 8088
73774 82609
16505 89533
34672 66570
76498 7952
58722 86631
54795 1655
29608 98885
49637 54726
13832...

output:

11111 9
32336 93205 73009 15072 89296 64417 99094 64655 43690 
99635 71830 95411 85177 64647 3509 53874 46947 5695 
8344 73845 85976 16854 15246 37108 49130 47602 79368 
96538 63448 22881 87317 5591 72866 41240 50842 72139 
22069 17907 77710 26240 72311 79025 27922 68522 42301 
44703 58414 91534 401...

result:

ok correct, length=11111

Test #34:

score: 0
Accepted
time: 138ms
memory: 32248kb

input:

96369 192735
66174 26431
54985 44603
56243 55417
71535 50697
11974 28932
75950 2886
10205 34789
29441 2121
77431 9570
24054 35021
89846 77109
44950 82267
55132 32517
33318 2584
55754 9025
22418 54319
50659 95499
11829 43645
77594 95086
57504 32024
90030 76308
6192 29137
67415 5652
76014 60625
76287 ...

output:

32123 3
9945 47548 69374 
69810 26783 16016 
66650 76320 95521 
52357 38451 42352 
37485 18723 59234 
90651 11826 17397 
32103 32982 32182 
51696 81088 67836 
9483 63159 22567 
55096 21032 36747 
75062 17916 72465 
70398 71335 32021 
59699 24875 10870 
90544 34319 3942 
178 63893 64903 
14680 34893 ...

result:

ok correct, length=32123

Test #35:

score: 0
Accepted
time: 48ms
memory: 20712kb

input:

15552 70848
3346 14558
11830 7645
3398 11164
587 1283
12051 9225
12053 7696
13908 3522
4785 7039
5415 2407
11945 13740
8950 658
12809 13466
5643 9283
9057 823
7430 3522
3248 2782
1584 14517
6457 13479
2573 12520
11295 8905
13365 9395
3897 13185
6567 2543
13759 8303
12506 1484
2390 2309
10391 4673
15...

output:

12 1296
654 15057 15411 7082 9686 11302 15066 2650 3913 5831 6509 1698 668 10832 11564 14497 11983 5993 2603 2802 480 9447 10277 12656 9570 7569 13510 2604 3773 9585 2814 5371 11850 67 440 5781 4213 794 3323 6898 4260 5176 8046 12091 543 13931 7729 13096 3235 4325 359 1023 3000 4967 9492 7997 7645 1...

result:

ok correct, length=12

Test #36:

score: 0
Accepted
time: 58ms
memory: 26176kb

input:

100000 100000
54091 14983
76439 8580
2460 83836
16022 59989
57574 5789
73735 30986
21840 32025
8324 39780
46667 84340
63520 74272
12132 10130
22196 9498
35986 45019
37679 58366
74860 52785
79536 2371
60710 8307
54861 69272
76341 42520
9062 78601
82356 19287
859 97172
59299 45257
45623 40919
72762 74...

output:

1 100000
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 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 correct, length=1

Test #37:

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

input:

100000 150000
80794 42947
86678 6817
26099 20454
66174 82645
2960 39366
72897 92882
14682 32867
81702 44441
73783 83084
16604 51431
66609 51415
22162 27338
26907 38524
80988 95078
25494 80351
43308 50371
12223 14580
44045 82563
22825 43916
69811 4268
6402 32699
26216 70440
15446 97779
32357 32843
30...

output:

2 50000
1 86618 27919 51336 60582 39403 78066 70968 24640 12720 37609 37212 86434 74448 78259 9274 10088 2333 85424 25397 64739 95738 9346 67366 96363 39003 48311 3125 11750 9076 63513 17833 84386 80593 30566 51580 44818 81574 3509 57255 27955 72655 17700 12915 41905 59427 26957 48273 41314 72799 82...

result:

ok correct, length=2

Test #38:

score: 0
Accepted
time: 125ms
memory: 22144kb

input:

3960 197901
577 2805
1025 811
880 3878
736 3163
3055 477
143 855
3066 654
2397 18
935 3864
2474 32
3782 529
3427 3706
3832 1440
554 1528
1081 2914
1573 3708
2387 1529
1299 3748
508 2292
2488 3272
3047 802
2512 3871
3952 1950
3392 1177
1432 2343
2707 2724
2445 1086
1996 2708
3815 980
948 1053
925 308...

output:

40 99
1 2336 1875 2691 3827 575 3251 1895 1942 2308 3527 1589 3300 376 976 3526 2472 1489 696 232 2175 2169 1098 557 2391 698 1360 2245 924 661 731 3294 3532 2311 2199 3654 3705 3495 3153 3683 3434 392 3804 2524 3225 384 355 3010 2897 631 40 2743 1676 3754 809 2536 2149 940 755 383 3596 2202 2052 23...

result:

ok correct, length=40

Test #39:

score: 0
Accepted
time: 102ms
memory: 26812kb

input:

100000 200000
86 85182
16753 23
77158 73238
24146 30587
61319 51078
56091 9029
29658 80460
98562 91965
23300 72604
69275 5643
60613 41486
26697 14087
53285 29446
8636 13245
5725 41748
73469 71134
3156 50243
56902 60387
46928 24097
80353 35259
23881 32520
2960 4576
19578 43449
6975 28521
75687 65551
...

output:

1 100000
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 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 correct, length=1

Test #40:

score: 0
Accepted
time: 136ms
memory: 36996kb

input:

100000 200000
91993 59625
41773 87382
37325 3233
72579 28738
54037 14135
30730 99035
21735 86648
27404 70180
68286 2646
26946 98819
15846 35730
55754 80212
40428 23521
16226 89098
98533 86698
22070 25317
92278 33830
40012 87919
87008 75431
52981 38295
72884 18898
63326 4795
3741 7304
2406 40150
6015...

output:

2 50000
3 62615 58634 5966 21207 57064 76006 44215 80252 62942 14545 75006 22988 15131 13874 92732 67080 24345 61022 12559 30350 39958 60308 42522 35529 49040 48152 19911 39177 95019 41787 63708 46961 27162 38039 48943 85396 15150 9852 63078 82889 86127 84768 5317 11382 68199 65644 45862 36101 46104...

result:

ok correct, length=2

Test #41:

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

input:

100000 200000
80787 99226
20200 85406
80249 76053
66751 49568
62297 81265
28771 46304
26206 69099
57603 55126
6327 57002
83192 34595
34529 18126
81212 77000
75945 72060
89561 37392
89176 95209
58922 85279
76806 76328
35906 47706
99208 12616
67276 28998
33753 98627
13183 22281
35463 57985
47633 11270...

output:

10 10000
20 91465 34652 57416 11682 53798 84198 18631 60658 33494 50941 49239 92212 84112 18206 25288 26434 12431 24759 83976 26255 82459 17605 43666 671 90592 48198 189 19645 71429 46053 77165 73173 26857 44817 86752 87938 20539 55992 76449 17335 3734 96669 36711 52425 63487 70192 49050 2376 14284 ...

result:

ok correct, length=10

Test #42:

score: 0
Accepted
time: 13ms
memory: 20200kb

input:

6531 15840
3777 2813
1527 6006
3062 2316
6079 4255
4995 1158
3579 1856
2084 5020
4544 1652
5545 3640
5126 3494
6308 4782
2843 4508
2528 3260
3590 2993
1605 5460
2666 4908
402 5601
1389 5693
1391 4667
3265 653
5418 256
848 3551
5633 1390
3605 4519
5233 5861
1252 2097
2224 4112
4570 2701
2883 5817
162...

output:

311 21
1005 2602 2621 6028 1505 4008 1387 2669 3580 3240 191 3575 409 2328 2361 4582 5745 1751 4736 2451 1813 
764 3211 1223 2543 304 5838 1570 4317 5775 4335 2325 5567 5858 2462 2636 2354 365 1299 2680 231 4789 
1603 5138 5182 4018 6351 3825 3402 1233 452 1769 2201 2482 1272 4902 4074 6496 209 4745...

result:

ok correct, length=311

Test #43:

score: 0
Accepted
time: 8ms
memory: 20520kb

input:

9832 22114
8236 6222
920 9270
7748 3236
6799 697
2530 680
6575 1905
2291 7596
2449 2191
6976 5976
4804 3997
1710 712
3112 3142
2493 5466
4308 2928
6724 6930
6060 8033
1247 7709
1057 9313
1341 514
2372 6534
1006 5209
6081 7443
6772 7399
8092 7819
1334 4825
6505 9791
9213 2455
1387 7090
8852 2908
4401...

output:

1229 8
1089 1180 6095 8379 1069 5498 4697 3253 
3148 3138 4787 2593 8430 111 3111 4057 
5888 2603 711 9397 4311 6710 7355 5110 
8455 2795 1080 77 9372 705 7826 6970 
635 4367 1702 369 1461 2331 8258 4450 
4997 3199 4938 5102 1986 2722 2223 2132 
6936 2873 1255 4870 52 6663 8171 7178 
5115 6810 2421 ...

result:

ok correct, length=1229

Test #44:

score: 0
Accepted
time: 171ms
memory: 25324kb

input:

1200 180300
786 728
504 1005
450 1092
781 1114
673 599
1177 125
242 123
1082 113
759 271
602 718
1089 153
251 995
73 539
1019 957
1198 641
1139 1045
407 25
28 158
752 449
724 1174
511 947
641 471
129 957
51 447
490 1088
1080 507
492 948
362 1179
226 626
417 929
443 260
880 22
1101 229
723 41
811 56
...

output:

4 300
5 967 683 299 407 329 878 113 653 627 644 364 57 1069 988 176 736 655 26 65 1022 643 66 162 757 696 406 998 118 1117 951 904 413 541 741 179 1130 485 684 1192 839 219 373 1087 85 538 199 1053 805 662 781 463 622 334 25 284 286 943 647 281 680 145 59 266 366 813 728 682 993 421 297 519 455 506 ...

result:

ok correct, length=4

Extra Test:

score: 0
Extra Test Passed