Submission #750233

# Submission time Handle Problem Language Result Execution time Memory
750233 2023-05-29T08:25:32 Z ammar124 Zalmoxis (BOI18_zalmoxis) C++17
35 / 100
456 ms 72956 KB
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
#define int 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 , ll>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;
}
# Verdict Execution time Memory Grader output
1 Correct 388 ms 72900 KB Output is correct
2 Correct 425 ms 72820 KB Output is correct
3 Correct 383 ms 72824 KB Output is correct
4 Correct 399 ms 72836 KB Output is correct
5 Correct 388 ms 72956 KB Output is correct
6 Correct 387 ms 72832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 381 ms 72768 KB Expected EOF
2 Correct 443 ms 72872 KB Output is correct
3 Incorrect 404 ms 72744 KB Unexpected end of file - int32 expected
4 Incorrect 414 ms 72764 KB Expected EOF
5 Incorrect 411 ms 72908 KB Expected EOF
6 Incorrect 428 ms 72784 KB Expected EOF
7 Incorrect 437 ms 72772 KB Expected EOF
8 Incorrect 456 ms 72872 KB Expected EOF
9 Incorrect 425 ms 67528 KB Expected EOF
10 Incorrect 207 ms 32652 KB Expected EOF
11 Incorrect 339 ms 48424 KB Expected EOF
12 Incorrect 65 ms 4248 KB Expected EOF
13 Incorrect 61 ms 4284 KB Expected EOF
14 Incorrect 68 ms 4240 KB not a zalsequence