QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86771#2026. Minimizing Edgeszhouhuanyi100 ✓35ms22388kbC++233.8kb2023-03-10 21:23:302023-03-10 21:23:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-10 21:23:33]
  • 评测
  • 测评结果:100
  • 用时:35ms
  • 内存:22388kb
  • [2023-03-10 21:23:30]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
#define N 200000
#define inf 1e9
using namespace std;
int read()
{
    char c=0;
    int sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
void Adder(int &x,int d)
{
    x=(x<d)?x:d;
    return;
}
struct reads
{
    int num,data;
};
int T,n,m,ans,q[N+1],dis[N+1],dis2[N+1];
bool used[N+1];
vector<int>E[N+1];
vector<reads>p[N+1];
vector<vector<int>>dp[N+1];
void add(int x,int y)
{
    E[x].push_back(y),E[y].push_back(x);
    return;
}
void bfs()
{
    queue<int>q;
    int top;
    q.push(1),dis[1]=0;
    while (!q.empty())
    {
	top=q.front(),q.pop();
	for (int i=0;i<E[top].size();++i)
	    if (dis[E[top][i]]>dis[top]+1)
		dis[E[top][i]]=dis[top]+1,q.push(E[top][i]);
    }
    return;
}
void bfs2()
{
    queue<int>q;
    int top;
    for (int i=1;i<=n;++i)
	if (used[i])
	    q.push(i),dis2[i]=dis[i];
    while (!q.empty())
    {
	top=q.front(),q.pop();
	for (int i=0;i<E[top].size();++i)
	    if (dis2[E[top][i]]>dis2[top]+1)
		dis2[E[top][i]]=dis2[top]+1,q.push(E[top][i]);
    }
    return;
}
bool cmp(int x,int y)
{
    return dis[x]<dis[y];
}
int main()
{
    bool op;
    int x,y,ps,res,minn;
    T=read();
    while (T--)
    {
	n=read(),m=read(),ans=0,op=1;
	for (int i=0;i<=(n<<1);++i) p[i].clear(),dp[i].clear();
	for (int i=1;i<=n;++i) E[i].clear(),used[i]=0,dis[i]=dis2[i]=inf;
	for (int i=1;i<=m;++i) x=read(),y=read(),add(x,y);
	bfs();
	for (int i=1;i<=n;++i)
	    for (int j=0;j<E[i].size();++j)
		if (dis[i]==dis[E[i][j]])
		    used[i]=1;
	for (int i=1;i<=n;++i) op&=(!used[i]);
	if (op)
	{
	    printf("%d\n",n-1);
	    continue;
	}
	bfs2();
	for (int i=1;i<=n;++i) q[i]=i;
	sort(q+1,q+n+1,cmp);
	for (int i=1;i<=n;++i)
	{
	    if (!p[dis[q[i]]+dis2[q[i]]].empty()&&p[dis[q[i]]+dis2[q[i]]].back().num==dis[q[i]]) p[dis[q[i]]+dis2[q[i]]].back().data++;
	    else p[dis[q[i]]+dis2[q[i]]].push_back((reads){dis[q[i]],1});
	}
	for (int i=0;i<=(n<<1);++i)
	    if (!p[i].empty())
	    {
		dp[i].resize(p[i].size()+1),ps=-1,minn=inf;
		for (int j=0;j<p[i].size();++j)
		{
		    while (i>=2&&ps+1<p[i-2].size()&&p[i-2][ps+1].num<=p[i][j].num-1) ps++;
		    op=(ps!=-1&&p[i-2][ps].num==p[i][j].num-1),dp[i][j].resize(p[i][j].data+1);
		    for (int k=0;k<dp[i][j].size();++k) dp[i][j][k]=inf;
		    if (!j||p[i][j-1].num+1!=p[i][j].num)
		    {
			if (j)
			{
			    res=inf;
			    for (int k=0;k<dp[i][j-1].size();++k) Adder(res,dp[i][j-1][k]);
			}
			else res=0;
			if (!p[i][j].num)
			{
			    if (!op)
			    {
				dp[i][j][p[i][j].data]=res;
			    }
			    else
			    {
				for (int k=0;k<dp[i][j].size();++k) dp[i][j][k]=res+p[i][j].data-k;
			    }
			}
			else if (op) dp[i][j][0]=res+p[i][j].data;
		    }
		    else
		    {
			if (!op)
			{
			    for (int k=0;k<dp[i][j-1].size();++k) Adder(dp[i][j][p[i][j].data],dp[i][j-1][k]+max(k,p[i][j].data));
			}
			else
			{
			    res=inf;
			    for (int k=0;k<dp[i][j].size();++k)
			    {
				if (k<dp[i][j-1].size()) Adder(res,dp[i][j-1][k]);
				Adder(dp[i][j][k],res+p[i][j].data);
			    }
			    res=inf;
			    for (int k=dp[i][j].size();k<dp[i][j-1].size();++k) Adder(res,dp[i][j-1][k]+k);
			    for (int k=(int)(dp[i][j].size())-1;k>=0;--k)
			    {
				Adder(dp[i][j][k],res+p[i][j].data-k);
				if (k<dp[i][j-1].size()) Adder(res,dp[i][j-1][k]+k);
			    }
			}
		    }
		}
		if ((p[i].back().num<<1)==i)
		{
		    for (int j=0;j<dp[i][(int)(p[i].size())-1].size();++j) Adder(minn,dp[i][(int)(p[i].size())-1][j]+((j+1)>>1));
		}
		else Adder(minn,dp[i][(int)(p[i].size())-1][0]);
		ans+=minn;
	    }
	printf("%d\n",ans);
    }
    return 0;
}

詳細信息

Test #1:

score: 5
Accepted
time: 2ms
memory: 19804kb

input:

2

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

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

output:

4
5

result:

ok 2 lines

Test #2:

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

input:

7

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

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

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

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

21 22
1 2
1 9
1 12
2 3
3 4
4...

output:

10
11
15
18
22
26
31

result:

ok 7 lines

Test #3:

score: 5
Accepted
time: 2ms
memory: 20192kb

input:

932

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

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

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

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

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

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

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

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

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

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

output:

5
5
5
5
6
5
5
5
6
5
5
4
5
5
5
5
5
5
6
5
5
6
4
5
5
5
5
5
5
5
4
5
6
5
4
5
4
4
5
5
5
5
5
5
5
5
5
5
6
4
6
5
5
5
5
5
5
5
5
4
5
6
3
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
6
5
5
5
4
6
5
5
4
5
5
5
5
6
5
5
5
7
5
6
5
5
4
5
5
5
5
5
5
5
5
5
5
5
5
5
6
6
5
4
5
5
4
5
5
5
5
5
5
5
6
5
5
5
5
4
6
5
5
5
5
5
5
4
...

result:

ok 932 lines

Test #4:

score: 5
Accepted
time: 18ms
memory: 19640kb

input:

47

4 4
2 4
2 3
3 4
1 3

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

3971 3971
1581 1785
1163 3539
337 3730
3056 3339
216 1231
97 102
585 3619
1773 3225
131 9...

output:

4
32
3971
9884
2757
84
2
2296
3308
15
8237
307
768
6
1106
369
11862
21
69
146
8
5719
6864
639
1329
11
18
212
14685
10
26
100
39
1595
532
3
14234
48
176
122
921
5
1914
256
443
4766
58

result:

ok 47 lines

Test #5:

score: 5
Accepted
time: 9ms
memory: 20032kb

input:

47

8237 8237
6556 7190
4824 5510
3790 4533
1394 8219
5916 6492
2773 7812
744 6485
138 5197
3915 4437
1119 1774
4148 6127
3410 7958
3831 5633
3379 7983
724 6031
404 2917
3060 6117
748 2639
7753 7760
1167 1504
3920 7875
2405 2611
656 2890
5962 6956
5690 6809
3743 7068
4623 4640
1011 6686
4652 7965
45...

output:

8236
14
3971
147
11862
17
256
1913
5
369
639
2
4
122
100
177
5720
444
48
26
9885
1328
7
14234
5
767
6864
1595
70
2756
922
40
2297
308
213
57
14685
4765
533
1107
84
9
3
21
11
3309
33

result:

ok 47 lines

Test #6:

score: 5
Accepted
time: 26ms
memory: 20148kb

input:

47

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

147 262
1 22
1 39
1 41
1 77
1 135
2 23
2 35
2 57
2 58
2 70
2 71
2 81
2 93
2 95
2 108
2 114
2 123
2 134
2 146
3 37
3 144
4 17
4 32
5 111
5 114
6 49
6 53
6 65
6 67
6 85
6 116
6 122
6 133
7 37
7 42
8 81
8 105
9 92
9 98
9 110
9 126
9 139
10 1...

output:

9
183
17
2348
120
957
244
15
301
1298
5
11596
763
652
4
145
100
1028
5245
542
16786
52
13
43
79
2701
3052
1520
363
6
32
37
9621
240
3
6276
454
7926
1881
12477
21
75
3643
17672
4848
7
65

result:

ok 47 lines

Test #7:

score: 5
Accepted
time: 35ms
memory: 20188kb

input:

47

84 165
1 4
1 6
1 7
1 9
1 10
1 12
1 15
1 18
1 19
1 20
1 22
1 23
1 24
1 30
1 31
1 34
1 36
1 37
1 40
1 43
1 46
1 47
1 48
1 49
1 50
1 51
1 53
1 54
1 55
1 57
1 61
1 62
1 63
1 66
1 68
1 69
1 70
1 73
1 76
1 77
1 78
1 79
1 81
1 82
1 84
2 44
2 84
3 44
3 84
4 44
5 44
5 84
6 44
7 44
8 44
8 84
9 44
10 44
11...

output:

109
2370
128
39
1919
1382
12064
5
5791
456
267
6
6320
17673
17
7
326
634
215
1613
25
2765
3
5
1334
11
509
173
3694
4773
13702
19
860
14
56
45
22
155
379
9668
84
43
8240
781
72
17254
3085

result:

ok 47 lines

Test #8:

score: 5
Accepted
time: 20ms
memory: 19992kb

input:

47

533 1042
1 37
1 65
1 93
1 104
1 106
1 122
1 238
1 256
1 284
1 299
1 385
1 388
1 482
1 503
2 224
2 329
3 152
3 510
4 152
4 164
5 152
5 510
6 68
6 224
7 173
7 345
8 152
8 510
9 73
9 425
10 279
10 510
11 240
11 480
12 173
12 210
13 68
13 224
14 460
14 479
15 151
15 480
16 160
16 240
17 173
17 345
1...

output:

595
779
14407
14958
118
84
5518
21
3186
31
4578
1967
251
21
32
13
42
1038
17
71
1240
211
2770
150
5
554
527
7
297
6
86
8181
3
1623
381
11
6530
109
2152
943
10693
52
189
6
17522
8624
3636

result:

ok 47 lines

Test #9:

score: 5
Accepted
time: 27ms
memory: 20672kb

input:

47

308 564
1 104
1 155
1 177
2 32
2 283
3 24
3 277
4 15
4 39
4 49
4 201
4 277
4 291
4 301
5 83
5 145
6 136
6 156
7 49
7 76
7 179
7 201
7 232
7 289
7 291
7 299
7 301
8 59
8 142
9 32
9 73
10 122
10 144
11 157
11 296
12 23
12 73
13 16
13 284
14 193
14 199
15 296
16 63
16 96
16 164
16 165
16 178
16 193...

output:

369
1900
491
17
2059
216
28
30
3957
10
22
307
14256
48
15802
80
83
7
6115
148
749
9867
5270
179
51
2488
15671
264
12
17
121
103
424
642
6
8
948
5
3
10806
1126
3064
8305
4601
55
1675
1310

result:

ok 47 lines

Test #10:

score: 5
Accepted
time: 15ms
memory: 18192kb

input:

1164

99 123
1 18
1 33
1 36
1 41
1 59
1 64
1 69
1 96
2 91
3 64
4 22
5 87
6 24
7 24
8 63
9 95
10 87
11 25
11 72
11 81
11 89
12 22
13 22
14 60
15 63
16 58
17 27
17 28
17 45
17 49
17 60
17 67
17 89
18 72
19 95
20 36
20 50
21 72
21 77
22 29
22 32
22 35
22 47
22 55
22 70
22 77
22 80
23 32
23 40
24 30
24 ...

output:

109
107
92
97
113
29
107
86
106
106
111
93
67
120
102
93
97
109
116
106
87
115
16
96
87
50
105
101
97
127
101
64
123
93
35
97
94
107
93
93
89
93
93
113
90
31
100
92
98
105
96
33
86
119
110
93
92
93
103
90
98
107
70
103
86
84
115
96
107
110
108
101
87
102
96
80
93
124
106
107
106
119
91
87
89
103
88
...

result:

ok 1164 lines

Test #11:

score: 5
Accepted
time: 5ms
memory: 20056kb

input:

1171

99 149
1 36
1 57
1 60
1 69
1 72
1 76
2 4
2 87
3 5
3 33
3 65
3 95
3 99
4 7
4 17
4 22
4 24
4 32
4 35
4 58
4 64
4 67
4 80
4 81
4 85
4 89
4 96
5 19
5 31
5 40
5 63
5 66
5 83
6 36
7 46
8 22
8 32
9 92
10 22
10 32
11 36
12 87
13 22
13 32
14 18
15 34
15 72
16 34
16 77
17 46
18 32
18 48
18 50
18 53
18 6...

output:

120
100
91
94
110
93
94
96
17
95
97
92
126
123
94
108
116
116
92
96
104
120
121
99
100
54
103
88
89
95
90
98
112
101
93
103
90
101
96
102
95
92
97
49
96
89
105
23
103
107
90
103
103
112
109
105
110
77
97
96
98
85
18
112
120
115
95
93
89
40
109
94
74
92
91
101
96
34
86
7
89
91
90
96
96
87
93
96
103
1...

result:

ok 1171 lines

Test #12:

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

input:

1175

86 91
1 38
1 63
1 82
2 72
3 12
3 31
3 39
3 47
3 63
4 52
4 85
5 14
6 19
7 19
7 79
7 81
8 19
8 32
8 65
8 71
9 78
10 16
10 45
11 14
11 77
13 22
13 80
13 82
13 85
15 27
15 72
17 22
18 37
18 66
20 38
21 49
21 53
22 48
22 73
23 58
23 59
23 68
23 77
24 27
25 80
26 38
28 56
28 77
29 37
30 82
31 84
33 ...

output:

86
89
107
91
105
91
111
91
97
98
43
107
100
100
96
98
103
104
102
108
92
106
120
104
97
99
96
99
94
115
7
106
95
94
103
100
105
106
120
17
91
43
105
80
101
98
102
10
110
108
107
87
101
94
98
110
86
89
121
90
88
118
98
101
96
96
122
115
65
90
95
88
86
121
95
114
91
101
101
120
92
101
105
92
15
102
95...

result:

ok 1175 lines

Test #13:

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

input:

1164

78 119
1 19
1 34
1 47
1 78
2 14
2 18
2 22
2 38
2 40
2 71
2 75
2 78
3 23
3 39
4 9
4 65
5 9
5 55
6 23
6 55
7 25
8 19
8 39
9 11
9 23
9 25
9 27
9 32
9 39
9 43
9 62
9 64
9 67
9 68
9 69
10 51
11 55
12 26
12 75
13 51
14 59
15 78
16 25
17 49
18 59
19 28
19 45
19 61
19 65
20 49
21 23
21 39
22 59
23 33
...

output:

89
99
109
108
105
106
111
94
117
118
126
114
104
98
120
89
96
30
97
91
99
107
105
93
115
96
96
99
99
96
102
102
91
92
94
87
116
99
93
106
88
95
96
107
86
97
92
84
105
90
104
104
105
108
102
108
98
90
102
97
3
94
120
106
24
57
102
109
105
93
86
107
72
98
105
95
102
94
123
98
101
84
106
14
100
93
46
1...

result:

ok 1164 lines

Test #14:

score: 5
Accepted
time: 18ms
memory: 19112kb

input:

1168

90 115
1 13
1 20
1 36
1 46
2 76
3 60
4 74
5 47
6 56
6 57
7 85
8 60
8 64
9 52
10 15
10 21
10 43
10 56
10 57
10 86
10 87
10 89
11 13
12 44
12 52
13 37
13 42
13 66
13 76
13 79
14 60
14 64
15 56
16 85
17 85
18 74
19 83
20 23
20 28
20 34
20 58
20 75
20 85
21 56
22 83
24 55
24 83
24 85
25 83
26 43
2...

output:

102
91
93
86
105
96
122
20
104
101
89
107
88
122
107
54
105
101
94
97
99
93
111
99
105
31
87
86
112
103
121
108
120
90
84
109
107
111
52
96
94
29
110
129
101
110
104
76
105
92
102
85
95
116
100
34
120
101
109
90
112
119
99
90
115
115
125
108
94
103
82
104
108
101
109
92
97
108
95
97
104
111
95
94
65...

result:

ok 1168 lines

Test #15:

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

input:

1181

99 111
1 17
1 57
1 78
1 92
2 26
2 51
3 89
4 7
4 23
4 40
4 58
4 64
4 72
4 84
5 44
5 72
6 26
7 68
7 83
8 26
9 95
10 39
10 93
11 33
11 67
11 68
12 89
12 95
13 51
14 89
15 51
16 39
17 57
18 44
18 72
19 51
20 73
21 95
22 31
22 55
22 59
22 72
22 86
24 95
25 30
26 62
26 85
26 87
26 88
27 28
27 46
27 ...

output:

106
83
115
102
85
97
95
96
97
112
87
37
59
105
107
65
110
109
107
100
121
97
87
10
98
122
108
94
89
89
93
26
10
21
92
99
93
90
93
111
90
99
87
106
95
105
107
92
109
111
98
101
106
108
96
44
89
93
107
48
14
103
102
71
117
99
99
97
99
88
96
89
90
104
91
88
91
98
105
18
112
95
102
2
98
103
93
51
14
111...

result:

ok 1181 lines

Test #16:

score: 5
Accepted
time: 29ms
memory: 22208kb

input:

92

99 136
1 14
1 51
1 77
1 79
1 93
1 95
2 29
3 45
3 49
4 9
4 86
5 45
5 49
6 93
7 45
7 61
8 45
8 61
9 13
9 19
9 25
9 26
9 38
9 40
9 62
9 69
9 74
9 85
9 92
10 41
11 69
12 29
13 58
14 35
15 29
16 22
17 41
18 36
19 86
20 45
20 61
21 71
22 34
22 35
22 43
22 72
22 80
23 71
24 45
24 61
25 86
26 58
27 29
2...

output:

110
80
73
154
288
217
298
244
211
240
53
584
290
30
270
127
165
179
269
919
103
314
166
319
107
69
209
738
179
271
826
906
256
282
139
233
191
237
54
186
33
140
322
231
289
255
145
576
190
93
31
29
101
107
73
758
300
233
124
252
300
845
213
78
226
50
27
261
287
247
471
136
531
169
48
816
364
98858
4...

result:

ok 92 lines

Test #17:

score: 5
Accepted
time: 24ms
memory: 22308kb

input:

96

99 121
1 10
1 16
1 25
1 51
1 60
1 67
1 94
2 73
2 99
3 3
3 21
3 62
3 63
3 68
3 76
3 82
3 85
4 59
5 74
6 40
7 14
8 96
9 11
9 29
9 37
9 41
9 43
9 50
9 80
9 97
10 43
12 70
12 74
13 60
13 70
14 32
14 33
14 52
14 55
14 60
14 77
14 91
15 79
17 74
17 96
18 59
19 26
19 34
19 53
19 57
19 64
19 72
19 84
19...

output:

107
96
403
72
222
315
158
118
604
98470
208
163
126
77
256
263
141
176
237
55
296
569
254
94
30
72
297
279
885
262
31
191
223
119
204
187
294
284
280
139
117
349
114
148
166
319
243
205
167
281
54
153
126
78
101
771
338
227
215
201
47
191
581
27
133
179
324
102
785
185
52
197
265
764
202
77
633
836
...

result:

ok 96 lines

Test #18:

score: 5
Accepted
time: 25ms
memory: 22156kb

input:

92

225 306
1 21
1 65
1 161
1 181
2 75
2 157
2 190
2 209
2 210
3 44
3 89
3 110
3 124
3 135
3 159
3 162
4 103
5 179
6 18
6 163
7 11
7 181
8 30
9 17
9 177
10 202
11 31
11 32
11 43
11 46
11 57
11 67
11 94
11 109
11 114
11 132
11 134
11 139
11 140
12 76
13 53
13 198
13 223
14 75
14 91
15 46
15 85
16 76
...

output:

255
50
104
171
34
299
670
28
29
435
208
74
264
83
92
80
254
99
603
185
120
686
130
49
125
294
125
143
91735
208
325
292
161
625
68
156
911
231
142
649
334
233
74
290
52
191
150
283
246
169
253
275
174
48
165
315
100
212
288
316
203
199
841
181
392
243
500
138
238
313
88
224
32
135
888
27
97
286
309
...

result:

ok 92 lines

Test #19:

score: 5
Accepted
time: 17ms
memory: 21916kb

input:

91

279 344
1 7
1 54
1 134
1 171
1 181
1 193
1 251
2 53
3 91
4 234
5 236
5 244
6 187
6 229
7 22
7 24
7 155
7 163
7 217
8 143
9 210
10 245
11 19
11 35
11 96
11 104
11 109
11 261
12 137
13 137
14 89
14 214
15 137
16 213
17 234
18 30
18 153
19 38
19 132
19 135
19 220
20 229
20 254
21 55
22 186
22 214
2...

output:

296
331
203
590
30
122
138
255
730
997
123
81
59
121
64
206
192
69
311
225
264
323
89
377
281
113
94
120
247
320
334
101
154
168
531
29
256
200
285
289
109
707
184
142
248
166
52
89107
31
293
234
28
165
239
191
139
270
99
267
211
189
192
233
538
84
146
54
930
70
642
308
47
214
278
47
819
152
271
252...

result:

ok 91 lines

Test #20:

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

input:

94

81 106
1 7
1 29
1 33
1 51
2 42
2 61
3 39
4 38
4 65
5 9
5 31
5 32
5 33
5 50
5 69
6 29
8 33
8 67
10 42
10 61
11 61
11 67
12 39
13 53
13 55
14 52
15 42
15 61
16 44
17 44
18 53
18 55
19 64
20 53
21 35
22 39
23 39
24 53
24 55
25 42
25 61
26 33
26 67
27 64
28 53
28 55
29 49
29 60
29 66
29 73
30 35
33 ...

output:

97
157
289
104
690
598
208
154
242
278
72
593
87
92
95
130
148
49
172
222
476
794
301
163
343
50
231
243
276
145
105
875
318
851
31
751
76
102
161
287
244
138
285
29
300
274
230
314
119
170
222
183
96
134
30
378
315
181
297
29
267
31
186
217
569
96
306
69
199
930
201
73
270
234
175
274
78
51
186
50
...

result:

ok 94 lines