QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498172#7278. Brought Down the Grading Server?shiomusubi49635 84ms35412kbC++173.1kb2024-07-30 01:50:092024-07-30 01:50:10

Judging History

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

  • [2024-07-30 01:50:10]
  • 评测
  • 测评结果:35
  • 用时:84ms
  • 内存:35412kb
  • [2024-07-30 01:50:09]
  • 提交

answer

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)

#define all(v) begin(v), end(v)

using namespace std;

using ll = long long;

constexpr ll inf = 1e18;

template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }

int main() {
    int N, S, T; cin >> N >> S >> T;
    vector<vector<int>> A(N, vector<int>(S));
    rep (i, N) rep (j, S) cin >> A[i][j], --A[i][j];
    vector<int> B(T, -1);
    queue<pair<int, int>> que;
    que.emplace(0, S);
    while (!que.empty()) {
        auto [l, r] = que.front(); que.pop();
        int m = (l + r) / 2;
        vector<int> C;
        vector<vector<pair<int, int>>> D;
        rep (i, N) rep2 (j, l, r) {
            if (B[A[i][j]] == -1) {
                C.push_back(A[i][j]);
                D.push_back({{i, j}});
                B[A[i][j]] = C.size() - 1;
                A[i][j] = C.size() - 1;
            }
            else {
                int t = B[A[i][j]];
                B[A[i][j]] = -1;
                D[t].push_back({i, j});
                A[i][j] = t;
            }
        }
        vector<vector<pair<int, int>>> E(N, vector<pair<int, int>>(r - l));
        {
            vector<pair<int, int>> F;
            rep (i, D.size()) {
                if (D[i].size() == 2) {
                    E[D[i][0].first][D[i][0].second - l] = D[i][1];
                    E[D[i][1].first][D[i][1].second - l] = D[i][0];
                }
                else {
                    F.push_back(D[i][0]);
                }
            }
            rep (i, F.size() / 2) {
                E[F[i * 2].first][F[i * 2].second - l] = F[i * 2 + 1];
                E[F[i * 2 + 1].first][F[i * 2 + 1].second - l] = F[i * 2];
            }
        }
        vector<vector<int>> res(N, vector<int>(r - l));
        vector<int> L(N, l), R(N, m);
        vector<vector<bool>> used(N, vector<bool>(r - l));
        vector<int> idx(N, l);
        rep (i, N) {
            while (idx[i] < r) {
                int ci = i, cj = idx[i]++;
                if (used[ci][cj - l]) continue;
                do {
                    used[ci][cj - l] = true;
                    res[ci][(L[ci]++) - l] = A[ci][cj];
                    auto [ni, nj] = E[ci][cj - l];
                    used[ni][nj - l] = true;
                    res[ni][(R[ni]++) - l] = A[ni][nj];
                    while (used[ni][idx[ni] - l]) ++idx[ni];
                    ci = ni, cj = idx[ni]++;
                } while (ci != i);
            }
        }
        rep (i, N) {
            rep (j, r - l) A[i][l + j] = C[res[i][j]];
        }
        if (l + 1 != m) que.emplace(l, m);
        if (m + 1 != r) que.emplace(m, r);
    }
    rep (i, N) {
        rep (j, S) cout << A[i][j] + 1 << " \n"[j + 1 == S];
    }
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2
2 3
3 2

result:

ok 

Test #2:

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

input:

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

output:

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

result:

ok 

Test #3:

score: 10
Accepted
time: 0ms
memory: 3600kb

input:

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

output:

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

result:

ok 

Test #4:

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

input:

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

output:

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

result:

ok 

Test #5:

score: 10
Accepted
time: 0ms
memory: 3604kb

input:

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

output:

13 1
4 14
14 13
1 17
8 15
14 5
3 7
20 6
1 9
19 11
6 20
11 13

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

score: 10
Accepted
time: 0ms
memory: 3780kb

input:

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

output:

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

result:

ok 

Subtask #2:

score: 15
Accepted

Test #8:

score: 15
Accepted
time: 78ms
memory: 34008kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894
90327 32116
63866 29061
53683 63612
70370 78264
42647 76881
31741 39251
66491 61186
57686 65819
59145 53278
26052 71962
81040 55279
50859 51310
24546 46800
85013 91165
61530 21890
29099 84003
86182 33573
49212 10639
91851 97312
57682 14067
5243 69674
62508 99007
26290 55524
43794 15519
5...

result:

ok 

Test #9:

score: 15
Accepted
time: 56ms
memory: 33868kb

input:

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

output:

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

result:

ok 

Test #10:

score: 15
Accepted
time: 50ms
memory: 34284kb

input:

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

output:

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

result:

ok 

Test #11:

score: 15
Accepted
time: 70ms
memory: 33632kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
3236 1660
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
17986 21912
92420 56526
40254 3472
20431 64330
56003 9381
45529 57750
45230 9388
53437 83797
47526 75562
63126 45219
71020 87437
50298 2016
21982 43667
37443 85...

result:

ok 

Test #12:

score: 15
Accepted
time: 62ms
memory: 30584kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
16229 17900
17481 10684
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
2821 11359
8897 14341
2482 3974
16241 17966
18146 15458
3345 15868
14507 18630...

result:

ok 

Test #13:

score: 15
Accepted
time: 42ms
memory: 33352kb

input:

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

output:

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

result:

ok 

Test #14:

score: 15
Accepted
time: 67ms
memory: 34048kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

53479 25002
63606 53479
53479 40735
83340 53479
40775 53479
53479 11458
8684 53479
53479 60405
45116 53479
53479 67722
53479 26014
87860 53479
53479 55147
22726 53479
53479 67769
129 53479
53479 14600
21514 53479
32164 53479
53479 60088
53479 25415
70946 53479
27091 53479
53479 33386
53479 6198
4838...

result:

ok 

Test #15:

score: 15
Accepted
time: 72ms
memory: 34248kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

8483 66963
63660 79073
41795 20397
84311 1296
3690 21178
21052 31611
51423 14323
82468 34208
83835 2785
50594 28274
59957 10993
34259 64334
73934 89407
61083 14947
89472 53201
61243 33351
58718 76632
67464 85318
54224 45096
84552 76529
30697 44253
3108 43669
26489 64691
85776 79840
10620 7691
69960 ...

result:

ok 

Test #16:

score: 15
Accepted
time: 76ms
memory: 33988kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
41994 73684
8908...

result:

ok 

Test #17:

score: 15
Accepted
time: 60ms
memory: 33840kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592
10704 12359
56718 35873
20301 28601
78422 55548
59974 74736
81664 29025
55916 70432
34185 47381
31764 56168
30947 33997
9029 70076
52532 67057
79680 99273
54410 56704
71652 45238
12615 6894
78041 66478
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
74551 6670
66711...

result:

ok 

Test #18:

score: 15
Accepted
time: 61ms
memory: 33948kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
43063 22633
63643 49914
4494 3571
53632 88758
17055 50019
49334 79039
67659 50111
17945 48061
60323 84596
72033 14629
77184 30069
64209 36217
49947 35279
44707 45866
58484 58146
1393 53385
49825 48048
586...

result:

ok 

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #19:

score: 5
Accepted
time: 78ms
memory: 34712kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894
90327 32116
63866 29061
53683 63612
70370 78264
42647 76881
31741 39251
66491 61186
57686 65819
59145 53278
26052 71962
81040 55279
50859 51310
24546 46800
85013 91165
61530 21890
29099 84003
86182 33573
49212 10639
91851 97312
57682 14067
5243 69674
62508 99007
26290 55524
43794 15519
5...

result:

ok 

Test #20:

score: 5
Accepted
time: 60ms
memory: 34076kb

input:

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

output:

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

result:

ok 

Test #21:

score: 5
Accepted
time: 51ms
memory: 34096kb

input:

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

output:

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

result:

ok 

Test #22:

score: 5
Accepted
time: 84ms
memory: 35412kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

47641 2360
27712 32311
5576 96580
69601 74432
90724 5497
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
98338 35990
14744 39222
72902 65183
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
53200 65669
74170 53434
44590 79062
66321 45816
37251 32926
26433 58003
72346 23461
6360...

result:

ok 

Test #23:

score: 5
Accepted
time: 60ms
memory: 33484kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76
53 35
8 70
61 48
98 12
72 81
62 87
10 6
83 61
63 42
66 10
7 46
35 66
52 47
30 60
70 33
27 16
82 32
28 8
85 83
21 95
84 63
47 57
86 89
73 69
60 52
78 72
61 78
36 61
3 73
31 50
20 47
69 28
34 74
100 79
56 99
43 51
15 86
38 28
94 3
76 63
19 56
90 31
79 97
23 3
14 44
63 78
99 85
50 14
4 90
87 41
5...

result:

ok 

Test #24:

score: 5
Accepted
time: 76ms
memory: 34000kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923
15159 469
15225 23585
1824 11180
7967 39735
13852 38886
33137 27292
21697 28740
13116 9887
33405 25732
39496 9156
24569 31286
32138 12900
1862 2345
18626 2824
25016 19382
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
14279 39650
1957 8842
22521 15206
34238 10717
329...

result:

ok 

Test #25:

score: 5
Accepted
time: 66ms
memory: 33284kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
3236 1660
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
17986 21912
92420 56526
40254 3472
20431 64330
56003 9381
45529 57750
45230 9388
53437 83797
47526 75562
63126 45219
71020 87437
50298 2016
21982 43667
37443 85...

result:

ok 

Test #26:

score: 5
Accepted
time: 59ms
memory: 30580kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
16229 17900
17481 10684
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
2821 11359
8897 14341
2482 3974
16241 17966
18146 15458
3345 15868
14507 18630...

result:

ok 

Test #27:

score: 5
Accepted
time: 50ms
memory: 34016kb

input:

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

output:

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

result:

ok 

Test #28:

score: 5
Accepted
time: 73ms
memory: 34536kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

53479 25002
63606 53479
53479 40735
83340 53479
40775 53479
53479 11458
8684 53479
53479 60405
45116 53479
53479 67722
53479 26014
87860 53479
53479 55147
22726 53479
53479 67769
129 53479
53479 14600
21514 53479
32164 53479
53479 60088
53479 25415
70946 53479
27091 53479
53479 33386
53479 6198
4838...

result:

ok 

Test #29:

score: 5
Accepted
time: 78ms
memory: 34476kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

8483 66963
63660 79073
41795 20397
84311 1296
3690 21178
21052 31611
51423 14323
82468 34208
83835 2785
50594 28274
59957 10993
34259 64334
73934 89407
61083 14947
89472 53201
61243 33351
58718 76632
67464 85318
54224 45096
84552 76529
30697 44253
3108 43669
26489 64691
85776 79840
10620 7691
69960 ...

result:

ok 

Test #30:

score: 5
Accepted
time: 69ms
memory: 33992kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
41994 73684
8908...

result:

ok 

Test #31:

score: 5
Accepted
time: 56ms
memory: 33960kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592
10704 12359
56718 35873
20301 28601
78422 55548
59974 74736
81664 29025
55916 70432
34185 47381
31764 56168
30947 33997
9029 70076
52532 67057
79680 99273
54410 56704
71652 45238
12615 6894
78041 66478
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
74551 6670
66711...

result:

ok 

Test #32:

score: 5
Accepted
time: 63ms
memory: 34020kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
43063 22633
63643 49914
4494 3571
53632 88758
17055 50019
49334 79039
67659 50111
17945 48061
60323 84596
72033 14629
77184 30069
64209 36217
49947 35279
44707 45866
58484 58146
1393 53385
49825 48048
586...

result:

ok 

Subtask #4:

score: 5
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #33:

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

input:

3 2 3
1 2
2 3
2 3

output:

1 2
2 3
3 2

result:

ok 

Test #34:

score: 5
Accepted
time: 71ms
memory: 31304kb

input:

89868 2 20001
16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
17900 16229
10684 17481
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
11359 2821
14341 8897
3974 2482
16241 17966
18146 15458
3345 158...

output:

16598 13223
18759 19981
2642 8681
4102 18080
11473 16749
690 15290
16229 17900
17481 10684
6328 12171
9417 1150
7185 5689
10346 17102
17958 9727
2117 13756
10955 13157
245 2840
5257 5337
16622 6429
17516 10772
13007 19349
2821 11359
8897 14341
2482 3974
16241 17966
18146 15458
3345 15868
14507 18630...

result:

ok 

Test #35:

score: 5
Accepted
time: 56ms
memory: 33844kb

input:

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

output:

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

result:

ok 

Test #36:

score: 5
Accepted
time: 75ms
memory: 34392kb

input:

100000 2 100000
53479 25002
53479 63606
53479 40735
53479 83340
53479 40775
53479 11458
53479 8684
53479 60405
45116 53479
67722 53479
26014 53479
87860 53479
55147 53479
53479 22726
53479 67769
53479 129
14600 53479
53479 21514
53479 32164
60088 53479
53479 25415
70946 53479
53479 27091
33386 53479...

output:

53479 25002
63606 53479
53479 40735
83340 53479
40775 53479
53479 11458
8684 53479
53479 60405
45116 53479
53479 67722
53479 26014
87860 53479
53479 55147
22726 53479
53479 67769
129 53479
53479 14600
21514 53479
32164 53479
53479 60088
53479 25415
70946 53479
27091 53479
53479 33386
53479 6198
4838...

result:

ok 

Test #37:

score: 5
Accepted
time: 73ms
memory: 33976kb

input:

100000 2 90000
8483 66963
63660 79073
41795 20397
1296 84311
3690 21178
21052 31611
51423 14323
34208 82468
83835 2785
50594 28274
59957 10993
34259 64334
89407 73934
14947 61083
53201 89472
61243 33351
76632 58718
67464 85318
54224 45096
84552 76529
44253 30697
43669 3108
26489 64691
79840 85776
76...

output:

8483 66963
63660 79073
41795 20397
84311 1296
3690 21178
21052 31611
51423 14323
82468 34208
83835 2785
50594 28274
59957 10993
34259 64334
73934 89407
61083 14947
89472 53201
61243 33351
58718 76632
67464 85318
54224 45096
84552 76529
30697 44253
3108 43669
26489 64691
85776 79840
10620 7691
69960 ...

result:

ok 

Test #38:

score: 5
Accepted
time: 63ms
memory: 34044kb

input:

99458 2 99458
80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
73...

output:

80944 83824
25208 26621
57146 28836
43915 18169
59242 47842
34224 78881
38791 20722
89723 91046
72800 40306
92681 94906
41151 7263
76035 13332
93928 38800
97168 86055
44186 73623
68071 7391
20692 72265
44111 42596
36037 77687
64592 836
43568 35187
34861 88539
37477 22111
85787 98028
41994 73684
8908...

result:

ok 

Test #39:

score: 5
Accepted
time: 66ms
memory: 33956kb

input:

100000 2 100000
91980 92592
12359 10704
35873 56718
28601 20301
78422 55548
74736 59974
81664 29025
55916 70432
47381 34185
31764 56168
33997 30947
70076 9029
52532 67057
79680 99273
54410 56704
45238 71652
12615 6894
66478 78041
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
...

output:

91980 92592
10704 12359
56718 35873
20301 28601
78422 55548
59974 74736
81664 29025
55916 70432
34185 47381
31764 56168
30947 33997
9029 70076
52532 67057
79680 99273
54410 56704
71652 45238
12615 6894
78041 66478
40520 5451
58133 5950
89237 70551
36028 97551
83553 90630
15211 33690
74551 6670
66711...

result:

ok 

Test #40:

score: 5
Accepted
time: 67ms
memory: 33880kb

input:

99555 2 99555
79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
22633 43063
49914 63643
4494 3571
88758 53632
17055 50019
49334 79039
67659 50111
17945 48061
84596 60323
14629 72033
77184 30069
64209 36217
49947 35279
45866 44707
58146 58484
1393 53385
4...

output:

79301 40457
40457 80634
49074 21580
92701 14354
44540 70461
47132 47637
84954 27979
87556 60683
43063 22633
63643 49914
4494 3571
53632 88758
17055 50019
49334 79039
67659 50111
17945 48061
60323 84596
72033 14629
77184 30069
64209 36217
49947 35279
44707 45866
58484 58146
1393 53385
49825 48048
586...

result:

ok 

Test #41:

score: 5
Accepted
time: 57ms
memory: 33928kb

input:

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

output:

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

result:

ok 

Test #42:

score: 5
Accepted
time: 51ms
memory: 33904kb

input:

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

output:

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

result:

ok 

Test #43:

score: 5
Accepted
time: 71ms
memory: 35400kb

input:

100000 2 100000
47641 2360
32311 27712
96580 5576
74432 69601
5497 90724
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
35990 98338
39222 14744
65183 72902
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
65669 53200
74170 53434
44590 79062
45816 66321
37251 32926
26433 58003
...

output:

47641 2360
27712 32311
5576 96580
69601 74432
90724 5497
61408 72215
86499 23207
43465 29593
49534 20236
83680 95890
98338 35990
14744 39222
72902 65183
76527 73553
40936 27695
96356 68239
66861 20211
59817 9499
53200 65669
74170 53434
44590 79062
66321 45816
37251 32926
26433 58003
72346 23461
6360...

result:

ok 

Test #44:

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

input:

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

output:

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

result:

ok 

Test #45:

score: 5
Accepted
time: 61ms
memory: 33752kb

input:

99000 2 100
50 76
35 53
70 8
48 61
12 98
81 72
62 87
10 6
61 83
63 42
66 10
7 46
35 66
47 52
30 60
70 33
27 16
32 82
8 28
85 83
95 21
63 84
47 57
89 86
73 69
52 60
72 78
78 61
61 36
3 73
31 50
47 20
69 28
74 34
100 79
99 56
51 43
86 15
38 28
3 94
63 76
19 56
31 90
79 97
3 23
14 44
78 63
99 85
14 50
...

output:

50 76
53 35
8 70
61 48
98 12
72 81
62 87
10 6
83 61
63 42
66 10
7 46
35 66
52 47
30 60
70 33
27 16
82 32
28 8
85 83
21 95
84 63
47 57
86 89
73 69
60 52
78 72
61 78
36 61
3 73
31 50
20 47
69 28
34 74
100 79
56 99
43 51
15 86
38 28
94 3
76 63
19 56
90 31
79 97
23 3
14 44
63 78
99 85
50 14
4 90
87 41
5...

result:

ok 

Test #46:

score: 5
Accepted
time: 81ms
memory: 34076kb

input:

99000 2 40000
13317 12923
15159 469
15225 23585
11180 1824
7967 39735
13852 38886
33137 27292
21697 28740
9887 13116
25732 33405
9156 39496
24569 31286
12900 32138
2345 1862
18626 2824
19382 25016
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
39650 14279
8842 1957
15206 22521
1...

output:

13317 12923
15159 469
15225 23585
1824 11180
7967 39735
13852 38886
33137 27292
21697 28740
13116 9887
33405 25732
39496 9156
24569 31286
32138 12900
1862 2345
18626 2824
25016 19382
11342 18721
10236 296
37626 8228
30418 10247
29998 33581
21676 4543
14279 39650
1957 8842
22521 15206
34238 10717
329...

result:

ok 

Test #47:

score: 5
Accepted
time: 36ms
memory: 20060kb

input:

50000 2 100000
98362 76208
42505 92719
18460 89381
66596 99759
12116 82137
92591 4043
134 72622
43432 47060
48543 74386
24648 12398
15658 30807
44636 99813
53782 10967
99129 43783
31224 17380
1594 90445
4363 11935
83427 79197
57698 64946
55536 76058
25332 10458
66313 31325
77601 43931
23727 27286
38...

output:

98362 76208
92719 42505
18460 89381
99759 66596
12116 82137
92591 4043
134 72622
47060 43432
48543 74386
12398 24648
30807 15658
44636 99813
10967 53782
99129 43783
31224 17380
90445 1594
11935 4363
79197 83427
64946 57698
55536 76058
25332 10458
31325 66313
77601 43931
23727 27286
46530 3848
1773 7...

result:

ok 

Test #48:

score: 5
Accepted
time: 1ms
memory: 3880kb

input:

1000 2 90000
23815 25217
6968 45020
4010 7431
26939 4476
2589 64334
32215 84328
8428 78626
15793 9319
30520 48129
73647 7113
69869 35054
2118 65562
13093 15772
66586 74609
2641 56451
80789 47288
35419 63553
4412 70594
45845 37418
71587 74602
19228 59932
53972 84459
7561 23333
29074 12664
26734 61072...

output:

23815 25217
6968 45020
4010 7431
26939 4476
2589 64334
32215 84328
8428 78626
15793 9319
30520 48129
73647 7113
69869 35054
2118 65562
13093 15772
66586 74609
2641 56451
80789 47288
35419 63553
4412 70594
45845 37418
71587 74602
19228 59932
53972 84459
7561 23333
29074 12664
26734 61072
65686 7825
5...

result:

ok 

Test #49:

score: 5
Accepted
time: 1ms
memory: 3808kb

input:

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

output:

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

result:

ok 

Test #50:

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

input:

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

output:

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

result:

ok 

Test #51:

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

input:

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

output:

13 1
4 14
14 13
1 17
8 15
14 5
3 7
20 6
1 9
19 11
6 20
11 13

result:

ok 

Test #52:

score: 5
Accepted
time: 0ms
memory: 3616kb

input:

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

output:

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

result:

ok 

Test #53:

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

input:

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

output:

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

result:

ok 

Test #54:

score: 5
Accepted
time: 72ms
memory: 33968kb

input:

100000 2 100000
70318 14894
32116 90327
63866 29061
53683 63612
70370 78264
42647 76881
39251 31741
61186 66491
57686 65819
53278 59145
71962 26052
81040 55279
50859 51310
46800 24546
85013 91165
61530 21890
84003 29099
33573 86182
49212 10639
91851 97312
57682 14067
5243 69674
99007 62508
26290 555...

output:

70318 14894
90327 32116
63866 29061
53683 63612
70370 78264
42647 76881
31741 39251
66491 61186
57686 65819
59145 53278
26052 71962
81040 55279
50859 51310
24546 46800
85013 91165
61530 21890
29099 84003
86182 33573
49212 10639
91851 97312
57682 14067
5243 69674
62508 99007
26290 55524
43794 15519
5...

result:

ok 

Test #55:

score: 5
Accepted
time: 76ms
memory: 33364kb

input:

98045 2 95001
27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
1660 3236
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
21912 17986
92420 56526
40254 3472
64330 20431
9381 56003
57750 45529
45230 9388
83797 53437
75562 47526
63126 45219
71020 87437
50298 2016
21982 ...

output:

27085 59126
75021 23663
67175 78883
3919 90698
20718 67504
49374 44011
3236 1660
71971 79270
24502 90540
54202 9732
14395 88659
56600 52635
17986 21912
92420 56526
40254 3472
20431 64330
56003 9381
45529 57750
45230 9388
53437 83797
47526 75562
63126 45219
71020 87437
50298 2016
21982 43667
37443 85...

result:

ok 

Subtask #5:

score: 0
Runtime Error

Test #56:

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

input:

3 4 3
2 3 2 2
2 3 3 2
2 2 3 2

output:

2 2 2 3
3 3 2 2
2 2 3 2

result:

ok 

Test #57:

score: 15
Accepted
time: 4ms
memory: 4432kb

input:

2450 4 2450
540 475 1156 2334
2421 2439 1328 750
471 1051 2007 1792
1776 786 705 2269
1277 755 1674 1622
590 1378 1217 603
967 239 1658 1920
857 2307 1589 78
2172 861 2322 1634
2077 2021 1381 2179
1126 345 1547 2126
994 1214 1477 412
1857 2085 831 978
281 1844 2406 2174
521 2334 2254 1779
1508 905 1...

output:

540 2334 475 1156
2421 2439 750 1328
471 1792 1051 2007
1776 705 2269 786
1277 755 1622 1674
1217 590 603 1378
239 967 1920 1658
857 78 2307 1589
2172 861 1634 2322
2179 2077 2021 1381
1126 2126 1547 345
994 1214 412 1477
1857 2085 831 978
2406 1844 281 2174
521 1779 2334 2254
905 1903 1508 284
345 ...

result:

ok 

Test #58:

score: 15
Accepted
time: 4ms
memory: 4368kb

input:

2499 4 2499
1 2 2 3
1429 1 1 1429
3 4 4 7
1430 3 3 1430
5 6 6 1
1431 5 5 1431
7 8 8 11
1432 7 7 1432
9 10 10 5
1433 9 9 1433
11 12 12 15
1434 11 11 1434
13 14 14 9
1435 13 13 1435
15 16 16 19
1436 15 15 1436
17 18 18 13
1437 17 17 1437
19 20 20 23
1438 19 19 1438
21 22 22 17
1439 21 21 1439
23 24 24...

output:

1 2 3 2
1429 1 1 1429
3 4 7 4
1430 3 1430 3
5 6 6 1
1431 5 1431 5
7 8 11 8
1432 7 1432 7
9 10 5 10
1433 9 9 1433
11 12 15 12
1434 11 1434 11
13 14 14 9
1435 13 1435 13
15 16 19 16
1436 15 1436 15
17 18 13 18
1437 17 17 1437
19 20 23 20
1438 19 1438 19
21 22 22 17
1439 21 1439 21
23 24 27 24
1440 23 ...

result:

ok 

Test #59:

score: 15
Accepted
time: 4ms
memory: 4804kb

input:

5000 2 5000
3581 2773
462 1582
1171 208
74 4865
1018 10
1962 2532
578 1491
1140 4567
3640 4785
1051 3325
4545 2135
1152 286
309 4874
1953 3646
1794 234
1223 3529
3751 1002
3427 4740
4638 2554
933 1988
3177 1846
2440 2671
1315 3502
1382 2669
3145 443
438 2418
420 1154
671 3875
3152 1807
3618 1093
359...

output:

3581 2773
1582 462
208 1171
74 4865
1018 10
1962 2532
578 1491
4567 1140
3640 4785
1051 3325
4545 2135
286 1152
4874 309
1953 3646
1794 234
1223 3529
1002 3751
3427 4740
2554 4638
1988 933
1846 3177
2440 2671
3502 1315
2669 1382
3145 443
2418 438
1154 420
671 3875
1807 3152
1093 3618
359 3471
4738 3...

result:

ok 

Test #60:

score: 15
Accepted
time: 3ms
memory: 4940kb

input:

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

output:

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

result:

ok 

Test #61:

score: 15
Accepted
time: 3ms
memory: 4676kb

input:

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

output:

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

result:

ok 

Test #62:

score: 0
Runtime Error

input:

156 64 156
29 104 122 93 114 102 62 151 145 125 155 109 97 116 62 72 83 122 60 109 125 19 14 101 80 125 76 155 123 128 123 57 7 154 36 60 123 36 19 89 12 3 29 36 145 66 9 13 132 26 97 89 4 95 92 19 86 140 33 89 55 5 102 119
148 71 119 10 75 47 27 30 4 109 92 63 55 28 2 156 3 123 84 10 60 13 5 93 125...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 0
Skipped

Dependency #2:

100%
Accepted

Dependency #5:

0%

Subtask #9:

score: 0
Skipped

Dependency #3:

100%
Accepted

Dependency #6:

0%

Subtask #10:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

0%