#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 66;
vector<int> v[N] , a(N);
void func(int x , int k){
if(k == 0 || x == 0){
cout<<x<<" ";
return;
}
k--;
func(x-1 ,k);
func(x-1 ,k);
}
int32_t main()
{
int n,k;
cin>>n>>k;
for(int i=0;i<n;i++){
cin>>a[i];
}
a[n] = 30;
int cem = 0;
for(int i = 0; i < n; i++){
cem += 1<<a[i];
while(__builtin_ctz(cem) < a[i+1]){
v[i].push_back(__builtin_ctz(cem));
cem += (cem & -cem);
k--;
}
}
for(int i=0;i<n;i++){
cout << a[i] << " ";
for(int x : v[i]){
func(k, x);
}
}
}
/*
1 1 2 2 3 3 4 4
1
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
181 ms |
29868 KB |
not a zalsequence |
2 |
Incorrect |
182 ms |
29780 KB |
not a zalsequence |
3 |
Incorrect |
177 ms |
29880 KB |
not a zalsequence |
4 |
Incorrect |
176 ms |
29820 KB |
not a zalsequence |
5 |
Incorrect |
196 ms |
29816 KB |
not a zalsequence |
6 |
Incorrect |
179 ms |
29776 KB |
not a zalsequence |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
460 ms |
45164 KB |
Expected EOF |
2 |
Incorrect |
175 ms |
29888 KB |
not a zalsequence |
3 |
Incorrect |
189 ms |
30120 KB |
Expected EOF |
4 |
Incorrect |
761 ms |
53708 KB |
Expected EOF |
5 |
Incorrect |
288 ms |
34412 KB |
Expected EOF |
6 |
Incorrect |
413 ms |
39816 KB |
Expected EOF |
7 |
Incorrect |
526 ms |
44400 KB |
Expected EOF |
8 |
Incorrect |
231 ms |
31936 KB |
Expected EOF |
9 |
Execution timed out |
1006 ms |
103088 KB |
Time limit exceeded |
10 |
Execution timed out |
1036 ms |
120588 KB |
Time limit exceeded |
11 |
Execution timed out |
1042 ms |
119244 KB |
Time limit exceeded |
12 |
Execution timed out |
1069 ms |
124032 KB |
Time limit exceeded |
13 |
Execution timed out |
1055 ms |
118956 KB |
Time limit exceeded |
14 |
Execution timed out |
1068 ms |
123680 KB |
Time limit exceeded |