QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#259677#2264. Secrets of Legendary TreasurePixelCat#AC ✓1ms3548kbC++201.2kb2023-11-21 10:41:212023-11-21 10:41:23

Judging History

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

  • [2023-11-21 10:41:23]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3548kb
  • [2023-11-21 10:41:21]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
// #define int LL
using namespace std;
using LL = long long;
using pii = pair<int, int>;

int src[110][110];

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n, m; cin >> n >> m;
    vector<int> v1(n + 1), v2(m + 1);
    For(i, 1, n) cin >> v1[i];
    For(i, 1, m) cin >> v2[i];
    memset(src, -1, sizeof(src));
    src[0][0] = 0;
    For(i, 0, n) For(j, 0, m) {
        if(i && (v1[i] == i + j || v1[i] == 0) && src[i - 1][j] != -1) {
            src[i][j] = 0;
        } else if(j && (v2[j] == i + j || v2[j] == 0) && src[i][j - 1] != -1) {
            src[i][j] = 1;
        }
        // cout << src[i][j] << " \n"[j == m];
    }
    int i = n, j = m;
    while(i || j) {
        // cerr << i << " " << j << "\n";
        if(src[i][j] == 0) {
            v1[i] = i + j;
            i--;
        } else if(src[i][j] == 1) {
            v2[j] = i + j;
            j--;
        }
    }
    For(i, 1, n) cout << v1[i] << " \n"[i == n];
    For(i, 1, m) cout << v2[i] << " \n"[i == m];
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3548kb

input:

100 100
1 2 3 4 6 10 11 14 17 18 19 21 24 25 26 27 29 32 34 35 36 37 39 40 44 49 52 53 55 59 65 66 67 68 73 74 81 82 83 85 86 88 89 90 96 98 99 102 103 104 106 107 108 116 117 118 121 124 127 128 129 130 131 132 134 137 138 139 141 145 148 149 152 153 154 156 157 158 161 162 163 167 169 170 173 174 ...

output:

1 2 3 4 6 10 11 14 17 18 19 21 24 25 26 27 29 32 34 35 36 37 39 40 44 49 52 53 55 59 65 66 67 68 73 74 81 82 83 85 86 88 89 90 96 98 99 102 103 104 106 107 108 116 117 118 121 124 127 128 129 130 131 132 134 137 138 139 141 145 148 149 152 153 154 156 157 158 161 162 163 167 169 170 173 174 175 177 ...

result:

ok correct

Test #2:

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

input:

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

output:

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

result:

ok correct

Test #3:

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

input:

90 96
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 92
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

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

result:

ok correct

Test #4:

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

input:

97 83
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

83 84 85 86 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 ...

result:

ok correct

Test #5:

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

input:

92 90
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

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

result:

ok correct

Test #6:

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

input:

96 100
97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

97 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 1...

result:

ok correct

Test #7:

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

input:

87 98
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 87
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

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

result:

ok correct

Test #8:

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

input:

83 83
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 ...

result:

ok correct

Test #9:

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

input:

94 89
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

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

result:

ok correct

Test #10:

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

input:

95 99
100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 ...

result:

ok correct

Test #11:

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

input:

90 99
0 0 6 0 0 0 16 0 19 0 21 23 27 29 31 34 35 37 0 44 46 0 49 0 53 54 0 0 0 0 65 66 67 0 71 0 74 75 0 77 0 79 80 82 84 85 0 0 95 97 102 0 105 0 109 0 111 112 0 115 116 120 0 124 127 0 130 134 0 137 141 0 144 148 150 151 153 0 160 165 0 0 171 0 0 0 185 0 187 188
1 0 5 8 11 12 0 14 15 18 22 0 0 0 0...

output:

3 4 6 7 9 10 16 17 19 20 21 23 27 29 31 34 35 37 41 44 46 47 49 50 53 54 57 58 59 61 65 66 67 70 71 73 74 75 76 77 78 79 80 82 84 85 92 94 95 97 102 104 105 107 109 110 111 112 114 115 116 120 123 124 127 129 130 134 136 137 141 143 144 148 150 151 153 155 160 165 166 167 171 181 182 183 185 186 187...

result:

ok correct

Test #12:

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

input:

51 92
4 7 8 11 0 0 26 29 0 44 0 0 50 0 57 0 61 65 67 70 0 78 0 80 82 0 86 89 90 91 95 100 103 104 0 0 108 109 112 0 116 0 118 0 0 125 130 131 134 137 141
0 2 3 5 6 9 10 12 13 0 15 0 18 19 0 22 23 24 0 27 0 30 31 0 34 35 36 0 0 39 40 41 42 0 0 0 49 0 52 53 54 56 58 59 62 0 0 66 0 69 72 73 0 0 76 77 8...

output:

4 7 8 11 17 21 26 29 33 44 47 48 50 55 57 60 61 65 67 70 71 78 79 80 82 85 86 89 90 91 95 100 103 104 105 106 108 109 112 113 116 117 118 120 122 125 130 131 134 137 141
1 2 3 5 6 9 10 12 13 14 15 16 18 19 20 22 23 24 25 27 28 30 31 32 34 35 36 37 38 39 40 41 42 43 45 46 49 51 52 53 54 56 58 59 62 6...

result:

ok correct

Test #13:

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

input:

79 87
0 0 4 5 7 10 0 12 0 17 24 27 28 0 30 31 32 0 0 0 0 0 43 45 0 50 51 54 56 62 63 65 67 0 70 71 0 0 75 0 0 80 0 89 91 92 0 0 102 104 0 106 107 108 110 112 117 119 120 0 123 125 132 135 0 139 140 141 142 0 0 145 0 149 0 154 0 157 0
1 0 8 9 13 15 16 0 19 20 21 0 0 25 26 0 35 0 38 42 44 0 0 0 0 53 5...

output:

2 3 4 5 7 10 11 12 14 17 24 27 28 29 30 31 32 34 37 39 40 41 43 45 49 50 51 54 56 62 63 65 67 69 70 71 73 74 75 76 79 80 81 89 91 92 98 101 102 104 105 106 107 108 110 112 117 119 120 122 123 125 132 135 138 139 140 141 142 143 144 145 148 149 153 154 155 157 161
1 6 8 9 13 15 16 18 19 20 21 22 23 2...

result:

ok correct

Test #14:

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

input:

53 85
0 5 7 8 22 0 27 0 0 33 34 0 40 0 45 48 51 0 55 57 0 59 63 64 0 69 0 0 80 81 0 84 0 88 0 103 104 105 106 0 113 0 116 117 121 122 0 127 130 0 135 137 0
0 2 3 6 0 0 0 0 13 14 0 0 17 0 19 20 21 23 0 26 29 0 0 35 36 37 0 0 0 0 46 47 49 0 0 54 56 60 61 0 0 0 0 70 71 73 75 76 77 78 79 83 0 87 89 0 91...

output:

4 5 7 8 22 25 27 28 32 33 34 39 40 44 45 48 51 53 55 57 58 59 63 64 68 69 72 74 80 81 82 84 86 88 101 103 104 105 106 110 113 115 116 117 121 122 125 127 130 134 135 137 138
1 2 3 6 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 26 29 30 31 35 36 37 38 41 42 43 46 47 49 50 52 54 56 60 61 62 65 66 67 70...

result:

ok correct

Test #15:

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

input:

71 72
0 0 0 0 10 13 0 16 18 0 20 22 0 24 25 26 28 29 0 31 40 42 0 0 0 47 48 0 51 52 55 0 57 0 67 0 69 70 71 0 0 0 83 0 0 0 0 93 95 0 100 105 0 107 0 109 110 112 0 0 120 122 0 0 126 128 129 132 133 142 0
0 3 0 6 0 11 12 0 17 21 27 32 33 0 0 36 37 38 39 0 0 0 53 0 58 0 60 61 62 63 64 65 0 73 74 75 0 7...

output:

2 5 8 9 10 13 15 16 18 19 20 22 23 24 25 26 28 29 30 31 40 42 44 45 46 47 48 50 51 52 55 56 57 66 67 68 69 70 71 77 81 82 83 86 87 89 90 93 95 99 100 105 106 107 108 109 110 112 115 119 120 122 123 124 126 128 129 132 133 142 143
1 3 4 6 7 11 12 14 17 21 27 32 33 34 35 36 37 38 39 41 43 49 53 54 58 ...

result:

ok correct

Test #16:

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

input:

78 58
0 0 0 0 9 0 0 0 16 0 0 19 21 0 0 24 0 26 0 0 0 0 38 0 0 42 45 0 50 53 0 0 0 0 0 0 66 0 0 71 0 0 74 0 0 78 0 0 82 0 0 0 0 0 91 0 0 0 0 0 0 0 0 0 0 0 0 0 120 121 0 0 125 0 0 0 0 0
0 0 0 0 0 13 0 0 28 0 0 0 0 35 0 41 43 0 0 0 0 0 0 0 59 0 0 0 64 0 0 0 0 0 0 0 0 0 97 0 100 0 0 106 0 0 109 113 0 0 ...

output:

5 6 7 8 9 11 12 15 16 17 18 19 21 22 23 24 25 26 27 33 34 37 38 39 40 42 45 49 50 53 55 56 57 58 63 65 66 69 70 71 72 73 74 76 77 78 80 81 82 86 87 88 89 90 91 94 95 96 99 103 104 105 110 111 112 117 118 119 120 121 123 124 125 128 133 134 135 136
1 2 3 4 10 13 14 20 28 29 30 31 32 35 36 41 43 44 46...

result:

ok correct

Test #17:

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

input:

83 82
0 0 0 0 0 0 0 0 23 0 0 29 0 0 0 39 0 0 0 43 0 0 0 0 0 51 0 0 0 0 0 0 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 98 0 0 102 103 0 107 0 0 110 0 0 0 0 120 0 0 123 0 0 0 0 0 0 136 0 0 0 0 148 0 0 0 0 161 165
0 0 0 0 11 0 0 0 0 0 0 0 0 0 25 0 28 0 32 0 0 0 0 44 0 0 55 0 0 0 0 0 0 67 0 69 0 0 0 81 0 0 0 85 0 0...

output:

5 6 7 8 9 10 21 22 23 24 27 29 31 37 38 39 40 41 42 43 46 47 48 49 50 51 53 54 61 62 63 64 65 73 74 75 76 77 78 79 80 88 89 90 91 96 97 98 100 101 102 103 106 107 108 109 110 115 116 118 119 120 121 122 123 129 130 131 132 133 134 136 142 143 144 147 148 157 158 159 160 161 165
1 2 3 4 11 12 13 14 1...

result:

ok correct

Test #18:

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

input:

84 77
0 0 6 0 9 10 14 0 18 0 0 32 0 0 0 42 47 0 50 51 0 0 55 0 0 0 0 0 0 73 0 0 0 0 80 0 0 83 0 0 0 87 0 0 0 0 96 0 0 0 102 0 104 0 0 108 110 112 0 0 0 0 119 0 121 122 0 0 0 0 0 0 0 0 0 0 0 145 148 153 156 157 0 159
0 0 0 0 0 0 0 0 0 0 20 0 0 0 0 0 0 0 0 31 34 0 0 39 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 0...

output:

4 5 6 8 9 10 14 17 18 29 30 32 33 37 38 42 47 49 50 51 53 54 55 61 62 63 68 69 70 73 76 77 78 79 80 81 82 83 84 85 86 87 90 93 94 95 96 99 100 101 102 103 104 105 107 108 110 112 113 114 117 118 119 120 121 122 123 124 130 135 136 137 138 139 140 141 144 145 148 153 156 157 158 159
1 2 3 7 11 12 13 ...

result:

ok correct

Test #19:

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

input:

56 51
0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 74 0 0 80 81 0 0 0 87 0 0 93 0 0 0 0 101 103 104 0
0 0 0 0 10 11 0 0 0 19 0 0 0 0 0 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 52 0 57 0 0 71 0 0 0 0 83 0 0 0 0 0 0 0 0 105 0

output:

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

result:

ok correct

Test #20:

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

input:

100 81
0 0 0 0 10 11 0 0 0 0 17 0 0 0 23 0 0 29 0 0 34 0 0 0 0 0 0 0 48 0 0 0 0 0 0 0 0 0 0 0 0 69 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 115 0 120 0 122 0 124 0 0 0 0 0 133 0 0 141 0 0 0 0 151 0 0 156 0 0 0 161 0 0 0 0 0 0 0 176 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 56 57 0 0 0 0 0 0 0 0...

output:

6 7 8 9 10 11 13 14 15 16 17 20 21 22 23 27 28 29 32 33 34 41 42 43 44 45 46 47 48 52 53 54 55 61 62 63 64 65 66 67 68 69 75 76 77 78 79 83 84 93 94 95 96 97 100 101 102 103 107 108 109 111 115 116 120 121 122 123 124 127 129 130 131 132 133 139 140 141 143 145 146 150 151 154 155 156 158 159 160 16...

result:

ok correct

Test #21:

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

input:

77 92
1 2 3 4 6 10 0 13 15 17 19 21 23 25 30 31 34 37 41 43 45 49 51 52 56 57 58 62 63 65 69 71 72 74 75 78 83 84 86 89 90 92 95 96 100 0 103 104 107 108 110 111 113 114 116 118 119 0 123 124 0 126 127 128 133 134 136 141 142 143 146 148 153 156 160 162 166
5 7 8 9 11 14 16 18 20 22 24 0 27 28 29 32...

output:

1 2 3 4 6 10 12 13 15 17 19 21 23 25 30 31 34 37 41 43 45 49 51 52 56 57 58 62 63 65 69 71 72 74 75 78 83 84 86 89 90 92 95 96 100 102 103 104 107 108 110 111 113 114 116 118 119 121 123 124 125 126 127 128 133 134 136 141 142 143 146 148 153 156 160 162 166
5 7 8 9 11 14 16 18 20 22 24 26 27 28 29 ...

result:

ok correct

Test #22:

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

input:

75 92
2 4 8 13 14 16 17 20 23 27 31 35 37 38 40 43 44 49 50 51 54 55 0 57 60 61 62 63 65 71 73 74 76 82 85 88 89 90 91 92 93 95 0 99 100 101 107 108 109 113 116 119 122 124 130 133 134 135 138 139 143 145 146 147 148 151 0 154 155 157 158 159 160 164 166
1 3 5 6 7 9 10 11 12 15 18 19 21 22 0 25 26 2...

output:

2 4 8 13 14 16 17 20 23 27 31 35 37 38 40 43 44 49 50 51 54 55 56 57 60 61 62 63 65 71 73 74 76 82 85 88 89 90 91 92 93 95 97 99 100 101 107 108 109 113 116 119 122 124 130 133 134 135 138 139 143 145 146 147 148 151 152 154 155 157 158 159 160 164 166
1 3 5 6 7 9 10 11 12 15 18 19 21 22 24 25 26 28...

result:

ok correct

Test #23:

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

input:

99 61
0 0 6 0 0 0 12 0 0 0 0 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 0 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124 0 0 0 0 0 0 0 0 0 0 0 141 0 0 0 0 0 148 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 102 ...

output:

4 5 6 9 10 11 12 16 17 18 19 20 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 53 54 55 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 132 133 134 135 136 137 138 139 140 141 143 144 145 146 147 14...

result:

ok correct

Test #24:

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

input:

70 79
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 98 0 0 0 0 0 0 0 0 0 0 0 0 0 135 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51 0 0 0 0 0 0 62 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 58 59 60 61 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 108 109 110 111 112 113 128 129 130 131 132 133 134 135 142 143 144 145 146 147 148 149
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26...

result:

ok correct

Test #25:

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

input:

5 5
0 0 6 0 0
0 0 3 0 0

output:

4 5 6 9 10
1 2 3 7 8

result:

ok correct

Test #26:

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

input:

2 2
1 0
0 4

output:

1 3
2 4

result:

ok correct

Test #27:

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

input:

6 3
0 0 0 5 0 0
3 0 7

output:

1 2 4 5 8 9
3 6 7

result:

ok correct

Test #28:

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

input:

5 5
3 0 0 0 8
1 0 0 0 10

output:

3 5 6 7 8
1 2 4 9 10

result:

ok correct

Test #29:

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

input:

97 97
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 17...

result:

ok correct

Test #30:

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

input:

99 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0

output:

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

result:

ok correct

Test #31:

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

input:

1 98
0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:

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

result:

ok correct