# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
568546 |
2022-05-25T16:40:08 Z |
urosk |
Zalmoxis (BOI18_zalmoxis) |
C++14 |
|
1000 ms |
1808 KB |
// __builtin_popcount(x)
// __builtin_popcountll(x)
#define here cerr<<"===========================================\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;
#define maxn 1000005
ll n,k;
vector<ll> v;
ll a[maxn];
int main(){
ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
cin >> n >> k;
bool bio = 0;
ll last = -1;
ll e = -1;
for(ll i = 1;i<=n;i++){
cin >> a[i];
ll x = a[i];
here;
for(ll x : v) cerr<<x<< " ";
cerr<<endl;
if(v.empty()||(sz(v)&&v.back()!=x)) v.pb(x);
else{
while(sz(v)&&x==v.back()){
v.popb();
v.pb(x+1);
last = i;
e = x+1;
bio = 1;
}
}
}
if(bio){
for(ll i = 1;i<=n;i++){
cout<<a[i]<< " ";
if(last==i){
cout<<e<< " ";
}
}
cout<<endl;
}else{
ll mn = llinf;
for(ll i = 1;i<=n;i++) mn = min(mn,a[i]);
for(ll i = 1;i<=n;i++){
cout<<a[i]<< " ";
if(a[i]==mn&&k>0){
cout<<mn<< " ";
k--;
}
}
cout<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
1808 KB |
Time limit exceeded |
2 |
Execution timed out |
1076 ms |
1684 KB |
Time limit exceeded |
3 |
Execution timed out |
1066 ms |
1496 KB |
Time limit exceeded |
4 |
Execution timed out |
1054 ms |
1612 KB |
Time limit exceeded |
5 |
Execution timed out |
1081 ms |
1344 KB |
Time limit exceeded |
6 |
Execution timed out |
1085 ms |
1636 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
1676 KB |
Time limit exceeded |
2 |
Execution timed out |
1091 ms |
1424 KB |
Time limit exceeded |
3 |
Execution timed out |
1091 ms |
1608 KB |
Time limit exceeded |
4 |
Execution timed out |
1088 ms |
1656 KB |
Time limit exceeded |
5 |
Execution timed out |
1071 ms |
1580 KB |
Time limit exceeded |
6 |
Execution timed out |
1094 ms |
1628 KB |
Time limit exceeded |
7 |
Execution timed out |
1091 ms |
1772 KB |
Time limit exceeded |
8 |
Execution timed out |
1082 ms |
1408 KB |
Time limit exceeded |
9 |
Execution timed out |
1081 ms |
1544 KB |
Time limit exceeded |
10 |
Execution timed out |
1084 ms |
1528 KB |
Time limit exceeded |
11 |
Execution timed out |
1092 ms |
1552 KB |
Time limit exceeded |
12 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |