QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#514970#2264. Secrets of Legendary TreasureCheek_support#AC ✓0ms3976kbC++201.5kb2024-08-11 14:00:312024-08-11 14:00:31

Judging History

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

  • [2024-08-11 14:00:31]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3976kb
  • [2024-08-11 14:00:31]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m;
int read(){
    char ch=getchar();int x=0,f=1;
    for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
    for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
    return f*x;
}
const int N=100100;
int a[N],b[N];
int qa[N],qb[N],t1=0,t2=0;
bool bo[N]={};
int main(){
    n=read();m=read();
    for(int i=1;i<=n;i++)a[i]=read(),bo[a[i]]=1;
    for(int i=1;i<=m;i++)b[i]=read(),bo[b[i]]=1;
    a[0]=b[0]=0;
    a[n+1]=b[m+1]=n+m+1;
    a[n+2]=b[m+2]=(1<<30);
    for(int i=0;i<=n+2;i++)if(a[i])qa[++t1]=i;
    for(int i=0;i<=m+2;i++)if(b[i])qb[++t2]=i;
    int i=0,j=0;
    for(;;){
        int x=qa[i],y=qa[i+1];
        int u=qb[j],v=qb[j+1];
        if(a[y]<b[v]){
            int now=x+1;
            for(int k=1;k<=n+m;k++){
                if(now==y)break;
                if(!bo[k]&&k>=a[x]){
                    bo[k]=1;
                    a[now++]=k;
                }
            }
            i++;
        }else{
            int now=u+1;
            for(int k=1;k<=n+m;k++){
                if(now==v)break;
                if(!bo[k]&&k>=b[u]){
                    bo[k]=1;
                    b[now++]=k;
                }
            }
            j++;
        }
        if(i==t1-1&&j==t2-1)break;
    }
    for(int i=1;i<=n;i++)printf("%d ",a[i]);
    puts("");
    for(int i=1;i<=m;i++)printf("%d ",b[i]);
    puts("");
    return 0;
}
/*
7 8
0 5 0 0 0 13 0
0 0 3 0 8 0 12 0
*/

详细

Test #1:

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

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: 0ms
memory: 3776kb

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: 3904kb

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:

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 92 
90 91 93 94 95 96 97 98 99 100 101 102...

result:

ok correct

Test #4:

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

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: 3936kb

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 9...

result:

ok correct

Test #6:

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

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: 0ms
memory: 3812kb

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: 3764kb

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: 3972kb

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: 3780kb

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: 0ms
memory: 3824kb

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 68 71 72 74 75 76 77 78 79 80 82 84 85 92 94 95 97 102 104 105 107 109 110 111 112 113 115 116 120 121 124 127 128 130 134 135 137 141 142 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: 0ms
memory: 3840kb

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 84 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 ...

result:

ok correct

Test #13:

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

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 46 50 51 54 56 62 63 65 67 68 70 71 72 73 75 76 78 80 81 89 91 92 98 100 102 104 105 106 107 108 110 112 117 119 120 121 123 125 132 135 138 139 140 141 142 143 144 145 146 149 150 154 155 157 161 
1 6 8 9 13 15 16 18 19 20 21 22 23 ...

result:

ok correct

Test #14:

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

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

result:

ok correct

Test #15:

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

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 7 8 10 13 14 16 18 19 20 22 23 24 25 26 28 29 30 31 40 42 43 44 45 47 48 49 51 52 55 56 57 66 67 68 69 70 71 77 79 80 83 86 87 89 90 93 95 98 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 9 11 12 15 17 21 27 32 33 34 35 36 37 38 39 41 46 50 53 54 58...

result:

ok correct

Test #16:

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

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:

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

result:

ok correct

Test #17:

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

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 12 13 23 24 27 29 31 33 34 39 40 41 42 43 45 46 47 48 49 51 53 54 56 57 58 59 65 73 74 75 76 77 78 79 80 88 89 90 91 93 94 98 99 100 102 103 104 107 108 109 110 115 116 118 119 120 121 122 123 129 130 131 132 133 134 136 142 143 144 146 148 149 150 151 152 161 165 
1 2 3 4 11 14 15 16 1...

result:

ok correct

Test #18:

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

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:

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

result:

ok correct

Test #19:

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

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:

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

result:

ok correct

Test #20:

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

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:

1 2 3 4 10 11 12 13 14 15 17 18 19 20 23 24 25 29 30 31 34 35 36 37 38 39 40 41 48 52 53 54 55 58 59 60 61 62 63 64 65 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 135 136 141 143 145 146 148 151 152 153 156 157 158 159 16...

result:

ok correct

Test #21:

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

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: 0ms
memory: 3880kb

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 2...

result:

ok correct

Test #23:

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

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:

1 2 6 7 8 9 12 13 14 15 16 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 50 51 52 53 55 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 106 107 108 109 110 111 112 113 114 124 125 126 128 129 130 131 132 133 134 135 136 141 142 143 144 145 146 148 ...

result:

ok correct

Test #24:

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

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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 98 108 109 110 111 112 113 115 116 117 118 119 120 121 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 2...

result:

ok correct

Test #25:

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

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: 3904kb

input:

2 2
1 0
0 4

output:

1 3 
2 4 

result:

ok correct

Test #27:

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

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: 3824kb

input:

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

output:

3 4 5 6 8 
1 2 7 9 10 

result:

ok correct

Test #29:

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

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: 3756kb

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: 3832kb

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