QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#249025#1344. Rooks GameAnwar_Gehad_Maghraby#AC ✓2ms7620kbC++234.2kb2023-11-11 23:49:342023-11-11 23:49:35

Judging History

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

  • [2023-11-11 23:49:35]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:7620kb
  • [2023-11-11 23:49:34]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = 1001 , MOD =  998244353 ; //1e9 + 7;

template <bool ToShuffle = false>
struct bipartite_matching {
    int n_left, n_right, flow = 0;
    std::vector<std::vector<int>> g;
    std::vector<int> match_from_left, match_from_right;

    bipartite_matching(int _n_left, int _n_right)
            : n_left(_n_left),
              n_right(_n_right),
              g(_n_left),
              match_from_left(_n_left, -1),
              match_from_right(_n_right, -1),
              dist(_n_left) {}

    void add(int u, int v) { g[u].push_back(v); }

    std::vector<int> dist;

    void bfs() {
        std::queue<int> q;
        for (int u = 0; u < n_left; ++u) {
            if (!~match_from_left[u])
                q.push(u), dist[u] = 0;
            else
                dist[u] = -1;
        }
        while (!q.empty()) {
            int u = q.front();
            q.pop();
            for (auto v : g[u])
                if (~match_from_right[v] && !~dist[match_from_right[v]]) {
                    dist[match_from_right[v]] = dist[u] + 1;
                    q.push(match_from_right[v]);
                }
        }
    }

    bool dfs(int u) {
        for (auto v : g[u])
            if (!~match_from_right[v]) {
                match_from_left[u] = v, match_from_right[v] = u;
                return true;
            }
        for (auto v : g[u])
            if (dist[match_from_right[v]] == dist[u] + 1 &&
                dfs(match_from_right[v])) {
                match_from_left[u] = v, match_from_right[v] = u;
                return true;
            }
        return false;
    }

    int get_max_matching() {
        if constexpr (ToShuffle) {

            for (int i = 0; i < n_left; ++i)
                std::random_shuffle(std::begin(g[i]), std::end(g[i]));
        }
        while (true) {
            bfs();
            int augment = 0;
            for (int u = 0; u < n_left; ++u)
                if (!~match_from_left[u]) augment += dfs(u);
            if (!augment) break;
            flow += augment;
        }
        return flow;
    }

    std::pair<std::vector<int>, std::vector<int>> minimum_vertex_cover() { //vertex cover max mat = x.sz + y.sz
        std::vector<int> L, R;
        for (int u = 0; u < n_left; ++u) {
            if (!~dist[u])
                L.push_back(u);
            else if (~match_from_left[u])
                R.push_back(match_from_left[u]);
        }
        return {L, R};
    }

    std::vector<std::pair<int, int>> get_edges() {
        std::vector<std::pair<int, int>> ans;
        for (int u = 0; u < n_left; ++u)
            if (match_from_left[u] != -1)
                ans.emplace_back(u, match_from_left[u]);
        return ans;
    }
};

int n , ex[N][N];

struct union_find {
    int comps;
    vector<int> parent, length;
    union_find(int n) {
        comps = n;
        parent.resize(n);
        iota(parent.begin(), parent.end(), 0);
        length = vector<int>(n, 1);
    }
    int find(int x) {
        if (parent[x] != x) {
            parent[x] = find(parent[x]);
        }
        return parent[x];
    }
    void unite(int x, int y) {
        int Px = find(x);
        int Py = find(y);
        if (Px == Py) { return; }
        comps--;
        if (length[Px] < length[Py]) {
            swap(Px, Py);
        }
        parent[Py] = Px;
        length[Px] += length[Py];
    }
};

int x[N] , y[N];
int max_ans() {
    union_find dsu(n);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (x[i] == x[j] || y[i] == y[j]) {
                dsu.unite(i, j);
            }
        }
    }
    return n - dsu.comps;
}

int32_t main() {

    cin.tie(0);cin.sync_with_stdio(0);
    cout.tie(0);cout.sync_with_stdio(0);

    int d ;
    cin >> d >> n;

    for(int i= 0 ; i < n; i++)
    {
        cin >> x[i] >> y[i] ;

        ex[ x[i] - 1 ][ y[i] - 1 ] = 1;
    }

    bipartite_matching<0> mat(d , d );

    for(int i= 0 ;i < d ; i++) for(int j =0 ; j < d ; j++) if( ex[i][j] ) mat.add(i , j) ;

    cout << n - mat.get_max_matching() << " " << max_ans() ;

    return 0;
}

詳細信息

Test #1:

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

input:

8 3
1 1
1 8
8 8

output:

1 2

result:

ok 2 number(s): "1 2"

Test #2:

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

input:

8 4
1 1
1 8
8 8
8 1

output:

2 3

result:

ok 2 number(s): "2 3"

Test #3:

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

input:

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

output:

0 0

result:

ok 2 number(s): "0 0"

Test #4:

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

input:

100 1
100 100

output:

0 0

result:

ok 2 number(s): "0 0"

Test #5:

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

input:

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

output:

7 8

result:

ok 2 number(s): "7 8"

Test #6:

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

input:

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

output:

6 9

result:

ok 2 number(s): "6 9"

Test #7:

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

input:

9 1
3 3

output:

0 0

result:

ok 2 number(s): "0 0"

Test #8:

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

input:

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

output:

8 12

result:

ok 2 number(s): "8 12"

Test #9:

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

input:

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

output:

7 12

result:

ok 2 number(s): "7 12"

Test #10:

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

input:

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

output:

13 17

result:

ok 2 number(s): "13 17"

Test #11:

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

input:

9 5
6 9
3 2
2 8
2 9
1 1

output:

1 2

result:

ok 2 number(s): "1 2"

Test #12:

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

input:

7 18
6 7
4 1
2 4
1 2
4 5
7 6
3 1
1 6
1 4
6 5
6 6
3 3
3 2
5 2
5 7
2 7
5 4
5 1

output:

11 17

result:

ok 2 number(s): "11 17"

Test #13:

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

input:

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

output:

4 5

result:

ok 2 number(s): "4 5"

Test #14:

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

input:

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

output:

10 16

result:

ok 2 number(s): "10 16"

Test #15:

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

input:

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

output:

9 14

result:

ok 2 number(s): "9 14"

Test #16:

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

input:

901 598
565 361
500 175
205 860
524 404
193 20
190 212
379 254
654 653
174 763
344 42
271 140
76 774
649 825
731 381
532 845
687 433
270 316
421 541
533 115
571 523
373 211
529 643
398 61
131 815
551 854
553 8
659 374
748 792
899 836
467 45
360 622
182 804
588 119
328 159
2 245
331 215
674 564
438 5...

output:

221 330

result:

ok 2 number(s): "221 330"

Test #17:

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

input:

530 551
370 236
26 367
405 200
55 355
436 316
478 344
397 315
476 392
60 512
233 526
514 248
429 325
477 356
525 375
216 421
239 87
250 469
25 397
425 285
202 251
53 99
351 463
421 416
366 292
474 331
368 377
14 46
302 517
468 5
402 78
86 297
313 524
418 133
65 268
53 420
449 245
184 31
318 307
497 ...

output:

248 396

result:

ok 2 number(s): "248 396"

Test #18:

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

input:

904 84
121 471
711 121
862 151
441 193
514 539
479 427
342 129
583 269
260 175
607 462
641 578
282 224
594 854
600 877
377 668
437 373
400 718
370 293
183 202
738 302
190 30
38 458
36 533
161 658
372 606
828 34
515 325
442 650
468 55
496 525
80 654
499 777
664 165
866 835
391 429
214 857
306 362
514...

output:

2 2

result:

ok 2 number(s): "2 2"

Test #19:

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

input:

322 197
178 243
39 189
83 306
293 89
254 60
223 82
96 176
262 302
276 15
135 248
265 232
63 281
179 242
51 241
199 261
266 305
196 183
299 120
287 291
223 137
127 150
267 251
227 19
18 294
37 95
207 149
1 120
188 48
310 195
52 129
142 34
15 196
281 111
102 17
87 247
261 78
63 259
156 103
190 222
154...

output:

64 91

result:

ok 2 number(s): "64 91"

Test #20:

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

input:

569 804
264 153
179 489
204 404
121 227
309 101
534 470
361 276
537 107
474 107
513 334
167 332
313 429
86 523
356 86
42 488
202 390
95 420
264 104
238 516
183 564
378 47
366 474
24 155
152 160
373 134
68 394
52 376
490 403
96 140
483 99
293 497
315 67
208 74
324 423
208 356
9 36
461 81
257 413
236 ...

output:

427 729

result:

ok 2 number(s): "427 729"

Test #21:

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

input:

254 526
54 106
142 201
49 219
238 117
136 242
171 196
132 49
59 44
195 169
103 230
222 77
154 159
142 81
3 233
215 136
180 105
37 95
92 137
238 204
186 46
229 247
252 234
221 4
228 233
218 228
61 207
11 200
123 93
209 227
54 108
219 74
209 83
206 50
132 234
77 229
178 7
101 21
147 61
163 238
241 58
...

output:

329 511

result:

ok 2 number(s): "329 511"

Test #22:

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

input:

300 844
197 204
168 265
277 270
101 251
192 36
222 79
270 212
242 139
161 124
169 220
182 249
177 252
101 248
176 139
190 2
209 267
121 297
139 132
22 155
291 222
225 256
260 231
115 118
163 166
79 3
45 140
111 241
287 275
248 71
208 4
33 152
97 295
134 43
46 212
129 98
79 255
238 131
296 77
107 290...

output:

572 839

result:

ok 2 number(s): "572 839"

Test #23:

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

input:

503 668
81 343
481 83
182 390
22 300
487 210
278 503
164 337
90 1
437 244
219 20
98 97
210 262
76 423
102 280
289 432
340 404
199 250
79 17
434 286
384 464
197 359
399 310
52 343
76 96
334 11
502 87
153 140
120 344
2 48
18 240
239 460
185 389
423 305
6 243
353 339
437 432
45 368
482 166
446 250
98 8...

output:

346 577

result:

ok 2 number(s): "346 577"

Test #24:

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

input:

300 848
273 182
240 132
279 174
237 281
279 180
131 34
24 238
239 8
274 237
63 24
79 233
204 105
75 243
17 30
121 106
121 190
274 293
50 143
19 47
116 276
20 107
296 289
238 271
96 251
86 214
286 154
168 17
135 297
29 164
231 3
51 125
186 265
56 164
134 237
13 179
35 39
211 135
287 97
89 160
75 129
...

output:

575 841

result:

ok 2 number(s): "575 841"

Test #25:

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

input:

166 728
126 14
151 109
118 126
112 37
76 151
6 71
98 94
117 79
101 90
84 42
117 112
42 7
54 6
155 98
94 30
130 11
118 89
119 120
57 3
9 16
14 117
66 158
109 129
44 33
35 81
9 132
123 61
75 144
32 109
123 5
89 61
103 88
96 111
122 104
19 21
166 83
94 1
2 103
121 92
37 124
166 150
56 56
73 48
80 143
1...

output:

564 727

result:

ok 2 number(s): "564 727"

Test #26:

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

input:

1 1
1 1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #27:

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

input:

7 49
1 1
1 2
1 3
1 4
1 5
1 6
1 7
2 1
2 2
2 3
2 4
2 5
2 6
2 7
3 1
3 2
3 3
3 4
3 5
3 6
3 7
4 1
4 2
4 3
4 4
4 5
4 6
4 7
5 1
5 2
5 3
5 4
5 5
5 6
5 7
6 1
6 2
6 3
6 4
6 5
6 6
6 7
7 1
7 2
7 3
7 4
7 5
7 6
7 7

output:

42 48

result:

ok 2 number(s): "42 48"

Test #28:

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

input:

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

output:

210 224

result:

ok 2 number(s): "210 224"

Test #29:

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

input:

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

output:

650 675

result:

ok 2 number(s): "650 675"

Test #30:

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

input:

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

output:

930 960

result:

ok 2 number(s): "930 960"

Test #31:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #32:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #33:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #34:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #35:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #36:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #37:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #38:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #39:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #40:

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

input:

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

output:

333 666

result:

ok 2 number(s): "333 666"

Test #41:

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

input:

1 1
1 1

output:

0 0

result:

ok 2 number(s): "0 0"

Test #42:

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

input:

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

output:

9 9

result:

ok 2 number(s): "9 9"

Test #43:

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

input:

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

output:

9 9

result:

ok 2 number(s): "9 9"

Test #44:

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

input:

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

output:

99 99

result:

ok 2 number(s): "99 99"

Test #45:

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

input:

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

output:

99 99

result:

ok 2 number(s): "99 99"

Test #46:

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

input:

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

output:

999 999

result:

ok 2 number(s): "999 999"

Test #47:

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

input:

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

output:

999 999

result:

ok 2 number(s): "999 999"