#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
ll power(ll a, ll b) { ll ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; }
int const maxin = 1e6+6;
ll const mod = 1e9+7;
int arr[maxin];
int a,b;
int meow = 0;
int cnt = 0;
int xx , yy;
int xc = 0 , yc = 0;
map<ll , int>mp;
void pls_work(int num)
{
int g = a+b - cnt;
int g2 = 0,g3 = 0;
for(int i=0;i<100;i++)
{
if(power(2 , i) > g)
break;
g2 = power(2,i);
g3 = i;
}
xx = num - g3;
yy = num - g3 - 1;
yc = (g - g2)*2;
xc = g - yc;
cnt = a+b;
}
void solve(int l , int r , int num)
{
if(cnt == a + b)
{
return;
}
int indx = (l+r)/2;
if(meow == a)
{
pls_work(num);
return;
}
if(num < arr[meow])
{
mp[indx] = num;
return;
cnt++;
}
if(num == arr[meow])
{
mp[indx] = num;
meow++;
cnt++;
return;
}
solve(l , indx , num-1);
solve(indx , r , num-1);
}
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>a>>b;
for(int i=0;i<a;i++)
{
cin>>arr[i];
}
solve(0 , 1e10+5 , 30);
for(auto it : mp)
{
cout<<it.second<<" ";
}
for(int i=0;i<xc;i++)
{
cout<<xx<<" ";
}
for(int i=0;i<yc;i++)
{
cout<<yy<<" ";
}
return 0;
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:68:19: warning: overflow in conversion from 'double' to 'int' changes value from '1.0000000005e+10' to '2147483647' [-Woverflow]
68 | solve(0 , 1e10+5 , 30);
| ~~~~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
405 ms |
68828 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
360 ms |
68632 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
393 ms |
68672 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
343 ms |
68660 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
387 ms |
68772 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
420 ms |
68872 KB |
Unexpected end of file - int32 expected |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
364 ms |
68664 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
382 ms |
68760 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
372 ms |
68564 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
379 ms |
68748 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
376 ms |
68560 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
378 ms |
68792 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
362 ms |
68624 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
378 ms |
68504 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
371 ms |
64184 KB |
Expected EOF |
10 |
Incorrect |
203 ms |
31564 KB |
Expected EOF |
11 |
Incorrect |
287 ms |
46364 KB |
Expected EOF |
12 |
Incorrect |
67 ms |
4324 KB |
Expected EOF |
13 |
Incorrect |
70 ms |
4320 KB |
Expected EOF |
14 |
Incorrect |
75 ms |
4296 KB |
not a zalsequence |