#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define MAX ((ll)(1e12+100))
#define MX ((ll)(1e6+100))
#define ARRS ((ll)(2e5+100))
#define HS ((ll)(233))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define LG 21
#define mul(a,b) a=((a)*(b))%MOD
using namespace std;
ll a[ARRS];
ll f[ARRS];
ll n;
vector<ll> v;
ll go(ll x,ll i){
if(x==a[i]){v.pb(x);return i+1;}
//if(x>a[i]){
i=go(x-1,i);
if(x<=a[i]||i==n){
f[v.size()]=1;
v.pb(x-1);
}
else
i=go(x-1,i);
return i;
//}
}
vector<ll> pas;
ll splt(ll x,ll k){
//cout<<x<<" "<<k<<endl;
if(x==0)return k-1;
if(k==1){pas.pb(x);return 0;}
k--;
k=splt(x-1,k);
k++;
splt(x-1,k);
return k-1;
}
int main(){
#ifdef KHOKHO
freopen("in.in","r",stdin);
freopen("out.out","w",stdout);
#endif // KHOKHO
ios::sync_with_stdio(0);
ll k;
cin>>n>>k;
for(int i=0; i<n; i++){
cin>>a[i];
}
go(30,0);
// for(int i=0; i<v.size(); i++){
// cout<<v[i]<<" "<<f[i]<<endl;
// }
k-=v.size()-n;
// vector<ll> pas;
for(int i=0; i<v.size(); i++){
if(f[i])
k=splt(v[i],k+1);
else pas.pb(v[i]);
}
for(auto x:pas){
cout<<x<<" ";
}
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:64:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<v.size(); i++){
~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
20 ms |
4088 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
20 ms |
4240 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
25 ms |
4240 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
22 ms |
4240 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
21 ms |
4268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
20 ms |
4292 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
20 ms |
4292 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Runtime error |
19 ms |
4296 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Runtime error |
19 ms |
4448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
4 |
Runtime error |
23 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
20 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
24 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
27 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
24 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
24 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
20 ms |
4460 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
20 ms |
4584 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Execution timed out |
1086 ms |
4584 KB |
Time limit exceeded |
13 |
Execution timed out |
1091 ms |
4584 KB |
Time limit exceeded |
14 |
Execution timed out |
1082 ms |
4584 KB |
Time limit exceeded |