QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227321#3422. PaintballBashca#AC ✓1ms3884kbC++231.4kb2023-10-27 12:17:272023-10-27 12:17:27

Judging History

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

  • [2023-10-27 12:17:27]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3884kb
  • [2023-10-27 12:17:27]
  • 提交

answer

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

struct BipartiteMatcher {
	vector<vector<int>> g;
	vector<int> L, R;
	vector<bool> vis;
	
	BipartiteMatcher(int n, int m):
		g(n), L(n, -1), R(m, -1), vis(n) {} 

	void add_edge(int a, int b) {
		g[a].emplace_back(b);
	}

	bool match(int x) {
		if (vis[x]) return 0;
		vis[x] = 1;
		for (int v : g[x])
			if (R[v] == -1)
				return R[L[x]=v]=x, 1;
		for (int v : g[x])
			if (match(R[v]))
				return R[L[x]=v]=x, 1;
		return 0;
	}
	
	int solve(vector<int>& rL) {
		int cnt = 1;
		//vector<int> ind(L.size());
		//for (int i = 0; i < ind.size(); ++i) {
		//	ind[i] = 1;
		//}
		//shuffle(ind.begin(), ind.end(), rng);
		while (cnt--) {
			fill(vis.begin(), vis.end(), 0);
			for (int i = 0; i < L.size(); ++i) {
				cnt |= L[i] == -1 and match(i);
			}
		}
		int res = 0;
		for (int i = 0; i < L.size(); ++i) {
			res += L[i] != -1;
		}
        rL = L;
		return res;
	}
};

int main() {
    int n, m;
    cin>>n>>m;
    BipartiteMatcher solver(n, n);
    for (int i=0; i<m; ++i) {
        int a, b;
        cin>>a>>b;
        a--; b--;
        solver.add_edge(a, b);
        solver.add_edge(b, a);
    }
    vector<int> res;
    if (solver.solve(res) == n) {
        for (int i=0; i<n; ++i) {
            cout << res[i] + 1 << '\n';
        }
    } else cout << "Impossible" << '\n';

    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3620kb

input:

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

output:

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

result:

ok good plan

Test #2:

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

input:

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

output:

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

result:

ok good plan

Test #3:

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

input:

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

output:

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

result:

ok good plan

Test #4:

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

input:

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

output:

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

result:

ok good plan

Test #5:

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

input:

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

output:

Impossible

result:

ok no solution

Test #6:

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

input:

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

output:

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

result:

ok good plan

Test #7:

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

input:

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

output:

Impossible

result:

ok no solution

Test #8:

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

input:

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

output:

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

result:

ok good plan

Test #9:

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

input:

160 348
2 6
3 7
5 7
10 12
7 17
9 22
14 22
12 23
20 25
1 31
32 33
23 34
6 36
7 38
9 38
13 40
24 40
37 40
14 41
20 42
1 44
6 45
16 45
8 49
27 49
6 50
9 50
14 50
17 50
47 50
41 51
45 51
36 53
31 54
48 54
9 55
51 55
26 56
36 57
5 58
19 62
29 62
33 62
43 62
52 62
26 63
13 64
3 65
6 65
62 65
20 66
54 66
4...

output:

31
131
65
156
7
36
3
70
22
136
80
10
64
41
99
117
144
73
94
25
81
14
135
107
20
63
85
90
110
145
129
93
127
139
133
6
40
84
69
160
137
77
126
74
16
128
50
86
72
47
45
132
89
66
51
79
75
146
114
103
87
29
26
92
62
54
121
109
39
43
108
49
18
44
57
97
71
95
56
120
21
122
88
12
27
48
61
101
102
42
105
1...

result:

ok good plan

Test #10:

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

input:

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

output:

18
120
163
158
71
167
21
91
179
19
108
70
180
57
26
98
62
133
12
56
174
173
185
168
90
151
161
189
28
169
140
50
97
157
126
45
148
190
20
9
10
4
187
127
36
160
1
96
100
32
128
63
112
74
39
141
55
116
61
152
59
181
52
38
153
105
31
86
72
138
5
69
7
136
159
81
171
80
3
48
34
156
188
114
54
142
147
110...

result:

ok good plan

Test #11:

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

input:

393 1228
6 14
3 25
24 31
24 32
21 33
33 34
32 38
8 40
22 43
42 43
18 44
13 45
30 45
44 48
20 51
14 52
31 52
6 53
20 53
53 54
53 55
54 55
30 56
24 57
33 57
36 58
12 60
39 60
10 64
24 64
18 66
33 66
62 67
60 69
48 72
46 74
17 75
63 76
3 79
16 79
66 79
72 79
2 80
42 80
51 82
28 83
49 83
82 83
33 86
26 ...

output:

141
80
116
162
271
276
257
153
152
212
91
334
362
52
118
291
75
281
220
53
251
144
112
57
89
128
254
135
316
56
348
109
34
103
261
146
121
104
134
8
207
305
233
187
120
253
149
206
83
367
369
113
371
363
294
200
24
178
311
260
240
67
270
10
388
342
62
192
352
312
174
234
338
105
159
209
273
163
344
...

result:

ok good plan

Test #12:

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

input:

375 1005
3 20
9 23
6 34
3 35
24 36
3 38
15 38
36 41
32 42
36 43
10 45
26 45
1 46
41 46
25 51
42 51
47 52
45 53
16 54
38 54
55 60
17 62
44 62
20 63
55 67
8 69
22 69
44 69
55 69
16 71
38 71
43 75
23 77
31 77
59 77
65 78
25 79
9 84
61 84
65 84
40 85
10 86
64 86
83 86
16 87
32 88
42 88
72 88
25 90
18 91...

output:

Impossible

result:

ok no solution

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

191 454
5 9
6 13
11 13
14 16
3 17
15 19
3 20
2 22
2 26
3 27
18 27
8 30
13 32
28 32
16 34
26 34
15 37
26 38
30 39
13 40
5 41
7 43
7 44
8 44
6 46
9 46
45 46
8 50
7 51
37 52
40 53
44 53
43 54
2 58
36 58
31 59
58 60
31 61
7 62
49 63
53 63
55 63
28 64
33 64
35 64
37 64
55 64
59 64
61 66
7 67
8 67
4 68
27...

output:

Impossible

result:

ok no solution

Test #15:

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

input:

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

output:

46
29
49
108
4
62
23
86
41
80
94
24
105
38
84
91
22
64
71
30
85
44
7
12
111
93
56
89
6
88
47
77
60
8
73
9
63
36
79
96
67
75
74
104
21
34
107
83
3
101
68
113
97
72
20
57
59
54
33
2
55
17
37
27
102
1
52
51
106
99
110
5
69
25
32
16
13
35
39
50
112
14
48
15
58
31
90
28
92
87
40
10
53
82
103
61
45
66
70
...

result:

ok good plan

Test #16:

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

input:

737 2432
6 11
12 16
10 20
22 23
1 26
19 26
9 35
6 37
38 40
10 41
15 44
37 45
2 49
6 50
29 53
16 54
42 57
32 58
55 59
28 63
35 64
4 68
44 69
15 71
4 72
21 72
54 73
63 73
46 76
26 79
42 79
16 81
34 82
34 83
64 83
47 84
30 87
60 90
50 92
64 92
74 94
40 95
2 96
39 96
66 97
42 98
57 99
59 103
99 103
10 1...

output:

574
176
601
259
692
50
663
672
635
687
6
126
416
582
340
385
579
475
26
317
304
124
147
437
131
581
404
373
382
87
335
512
393
498
64
276
45
678
267
95
597
79
313
632
641
250
390
344
731
92
648
336
156
694
710
236
99
387
450
538
383
405
73
35
286
640
292
107
209
369
726
4
63
94
232
371
623
691
329
5...

result:

ok good plan

Test #17:

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

input:

940 3352
12 25
15 27
19 40
2 41
37 46
32 47
27 49
40 49
10 50
22 52
23 53
26 56
50 56
6 57
55 60
45 62
17 63
8 64
7 69
15 70
2 78
21 81
33 81
17 82
79 84
54 86
82 86
74 88
34 91
26 94
6 95
91 95
91 96
26 97
33 98
74 98
14 103
20 103
3 107
63 108
64 109
107 109
63 110
106 111
109 111
42 112
5 113
28 ...

output:

467
41
172
263
219
934
69
755
373
50
241
25
303
215
860
121
320
311
152
477
174
637
763
234
514
762
49
884
906
316
390
47
98
674
325
248
190
607
635
291
188
147
690
268
62
260
743
445
27
155
345
910
476
470
175
764
908
246
252
382
730
251
108
222
834
176
895
701
289
613
368
703
450
88
498
297
591
20...

result:

ok good plan

Test #18:

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

input:

214 761
1 4
2 12
1 13
7 14
1 16
8 18
2 22
4 22
9 23
14 23
5 24
8 24
21 24
10 27
19 27
5 29
10 29
11 30
29 30
8 31
21 31
10 32
6 33
17 33
32 33
9 36
1 38
32 38
23 39
22 40
33 40
21 41
31 41
5 42
18 43
24 43
31 43
42 43
19 44
32 45
34 45
39 45
11 46
21 46
43 47
1 49
36 49
1 50
39 50
43 50
7 51
17 52
2...

output:

38
12
103
177
202
100
101
18
86
29
141
194
167
7
55
70
33
8
44
120
136
40
39
54
61
166
19
129
30
172
78
10
79
142
122
210
63
32
45
22
21
43
42
213
72
11
112
176
36
93
81
205
92
85
13
73
95
88
186
47
25
102
147
84
99
192
154
97
80
9
145
46
121
180
15
41
149
31
109
37
51
198
178
64
34
185
69
164
150
1...

result:

ok good plan

Test #19:

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

input:

915 2392
11 17
8 23
17 25
13 28
3 29
24 30
19 32
15 34
23 36
4 38
14 43
22 50
42 53
56 58
32 59
17 61
33 61
27 62
13 63
5 64
38 78
12 81
53 81
36 82
61 83
72 83
27 84
44 84
15 85
45 86
28 87
2 88
52 93
2 94
90 95
95 96
19 98
78 104
8 105
13 105
20 106
100 106
6 108
56 109
60 109
11 111
16 115
94 115...

output:

242
88
597
824
460
762
411
105
674
550
17
214
246
258
85
566
487
704
98
106
308
171
8
392
377
334
585
909
535
552
792
324
61
900
817
23
518
861
490
248
543
234
655
895
408
685
354
760
398
380
473
662
516
420
374
866
208
471
454
153
706
27
871
823
309
363
231
693
159
647
216
661
546
638
291
644
421
1...

result:

ok good plan

Test #20:

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

input:

563 1779
10 19
10 20
5 32
29 33
21 36
35 37
1 38
7 40
26 41
16 42
13 47
4 49
13 51
21 51
8 53
9 54
22 54
40 54
13 55
29 56
31 56
7 57
27 58
36 60
42 63
45 63
64 65
33 67
50 68
19 69
34 69
49 70
34 71
49 71
6 75
72 75
58 76
24 77
46 77
41 78
68 79
51 81
32 82
81 82
82 83
8 85
46 85
44 88
59 88
9 89
7...

output:

552
149
266
335
32
524
178
312
530
148
398
137
47
101
114
525
486
179
291
416
51
431
334
77
210
429
188
138
33
388
257
302
313
373
462
290
35
562
286
7
386
306
273
326
406
224
519
230
70
166
540
165
459
9
320
362
282
251
283
547
220
380
90
65
94
250
272
370
34
49
106
75
402
533
6
151
24
41
68
460
18...

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

647 1809
2 13
6 18
12 22
3 30
7 32
25 35
34 37
8 46
40 46
11 50
14 50
20 50
24 51
7 55
12 57
37 60
7 61
32 63
6 64
60 64
54 65
58 66
64 66
36 67
19 69
30 69
46 70
62 71
57 73
53 76
41 79
7 80
24 81
21 83
20 84
72 84
12 88
75 88
67 93
81 93
85 93
16 95
67 95
72 95
1 97
35 100
2 101
22 102
25 102
49 1...

output:

97
13
620
389
194
402
32
135
340
230
141
305
487
296
382
343
449
6
430
84
83
546
169
226
243
598
415
580
245
3
388
7
380
548
25
376
472
105
633
494
193
114
308
404
127
8
531
410
522
483
576
367
360
65
181
166
73
535
600
64
291
386
571
338
54
58
93
265
285
643
62
95
57
307
88
490
257
631
41
507
24
19...

result:

ok good plan

Test #23:

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

input:

583 1792
4 17
3 20
15 20
13 21
18 27
2 30
23 30
27 35
14 36
2 37
36 41
9 42
9 43
11 44
43 45
44 47
44 49
26 50
35 50
36 51
4 52
22 52
15 53
13 54
7 59
48 60
58 60
2 62
38 63
8 67
36 69
9 70
68 72
22 74
24 77
76 78
35 79
26 80
3 81
48 81
47 83
2 84
19 85
10 86
29 86
67 87
56 88
14 89
26 93
68 93
3 94...

output:

Impossible

result:

ok no solution

Test #24:

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

input:

546 1673
4 6
16 18
13 21
16 25
6 31
11 35
17 44
39 45
4 47
27 48
16 52
21 52
6 53
34 53
3 55
21 55
48 56
5 57
52 57
48 63
61 63
60 66
57 67
53 68
42 69
57 69
60 69
25 70
30 71
2 72
20 77
13 78
36 78
76 78
3 79
18 79
57 80
33 85
45 86
79 86
5 87
46 87
51 87
68 88
51 89
33 91
39 93
35 95
53 96
80 96
2...

output:

131
72
409
153
410
458
259
436
389
270
482
178
446
335
507
143
108
129
359
440
429
214
181
448
70
121
48
302
147
130
269
374
120
258
266
228
376
390
195
218
282
265
150
294
268
279
162
56
157
211
87
290
187
516
476
498
5
233
101
225
106
110
343
441
363
373
339
88
535
278
124
365
188
372
514
78
116
3...

result:

ok good plan

Test #25:

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

input:

729 2408
2 10
2 14
23 27
8 30
5 31
26 31
2 36
29 38
9 45
4 51
2 52
12 56
42 58
10 65
25 65
23 67
38 67
3 69
35 71
9 75
28 75
31 75
40 75
74 75
32 78
53 78
6 80
11 80
15 80
24 80
78 82
29 83
15 85
28 87
75 87
79 87
25 88
82 88
45 89
53 89
31 91
9 93
18 96
85 96
44 99
21 100
66 100
91 101
31 102
65 10...

output:

Impossible

result:

ok no solution

Test #26:

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

input:

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

output:

16
201
15
37
197
55
200
125
162
56
97
47
115
123
3
82
5
98
195
154
99
71
148
193
74
207
58
46
31
140
29
67
205
138
102
30
36
4
132
13
189
91
11
161
14
28
12
164
44
179
119
157
183
95
49
198
85
127
176
184
108
53
23
105
1
78
45
77
137
175
128
75
62
89
72
182
68
66
84
134
133
100
172
79
150
116
114
14...

result:

ok good plan

Test #27:

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

input:

283 842
5 10
8 11
14 15
8 18
20 22
23 24
10 26
14 27
5 28
27 33
7 34
24 35
34 39
38 39
8 40
27 40
10 42
37 43
6 44
17 45
32 46
8 47
31 47
21 48
6 49
43 49
20 51
16 52
25 53
48 53
50 53
17 55
3 56
10 56
36 56
14 57
18 58
14 62
56 62
42 64
39 65
13 66
31 66
6 67
40 67
56 67
14 68
6 70
18 70
26 70
61 7...

output:

Impossible

result:

ok no solution