#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,k;
cin >> n >> k;
vector <ll> arr(n);
vector <ll> low;
ll mini = 30;
for (int z=0;z<n;z++){
cin >> arr[z];
}
ll c = 0;
bool ok = true;
for (int z=0;z<n;z++){
c += 1 << arr[z];
for (int q=0;q<arr[z] && ok;q++){
if (c & (1 << q)){
ok = false;
cout << q << " ";
c += 1 << q;
break;
}
}
cout << arr[z] << " ";
}
if (ok){
for (int q=0;q<=30;q++){
if (c & (1 << q)){
cout << q << " ";
break;
}
}
}
cout << endl;
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:23:8: warning: unused variable 'mini' [-Wunused-variable]
ll mini = 30;
^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
169 ms |
10268 KB |
Output is correct |
2 |
Correct |
167 ms |
10256 KB |
Output is correct |
3 |
Correct |
163 ms |
10268 KB |
Output is correct |
4 |
Correct |
171 ms |
10276 KB |
Output is correct |
5 |
Correct |
167 ms |
10252 KB |
Output is correct |
6 |
Correct |
164 ms |
10208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
150 ms |
10368 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
159 ms |
10320 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
151 ms |
10212 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
148 ms |
10400 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
150 ms |
10216 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
152 ms |
10412 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
149 ms |
10228 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
156 ms |
10232 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
120 ms |
8412 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
48 ms |
3292 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
78 ms |
5328 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
2 ms |
276 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
2 ms |
376 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
2 ms |
256 KB |
Unexpected end of file - int32 expected |