답안 #750215

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
750215 2023-05-29T07:56:06 Z ammar124 Zalmoxis (BOI18_zalmoxis) C++17
0 / 100
152 ms 44264 KB
#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;
vector<int>v(1e7 + 6 , -1);
int meow = 0;
int cnt = 0;
int xx , yy;
int xc = 0 , yc = 0;
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])
    {
        v[indx] = num;
        return;
        cnt++;
    }
    if(num == arr[meow])
    {
        v[indx] = arr[meow];
        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 , 1e7+5 , 30);
    for(int i=0;i<1e7+6;i++)
    {
        if(v[i] != -1)
            cout<<v[i]<<" ";
    }
    for(int i=0;i<xc;i++)
    {
        cout<<xx<<" ";
    }
    for(int i=0;i<yc;i++)
    {
        cout<<yy<<" ";
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 113 ms 44048 KB Unexpected end of file - int32 expected
2 Incorrect 118 ms 44204 KB Unexpected end of file - int32 expected
3 Incorrect 125 ms 44108 KB Unexpected end of file - int32 expected
4 Incorrect 111 ms 44220 KB Unexpected end of file - int32 expected
5 Incorrect 117 ms 44208 KB Unexpected end of file - int32 expected
6 Incorrect 105 ms 43928 KB Unexpected end of file - int32 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 129 ms 44052 KB Unexpected end of file - int32 expected
2 Incorrect 121 ms 44008 KB Unexpected end of file - int32 expected
3 Incorrect 128 ms 44236 KB Unexpected end of file - int32 expected
4 Incorrect 114 ms 44236 KB Unexpected end of file - int32 expected
5 Incorrect 117 ms 44236 KB Unexpected end of file - int32 expected
6 Incorrect 113 ms 44116 KB Unexpected end of file - int32 expected
7 Incorrect 125 ms 44156 KB Unexpected end of file - int32 expected
8 Incorrect 122 ms 44264 KB Unexpected end of file - int32 expected
9 Incorrect 152 ms 43960 KB Unexpected end of file - int32 expected
10 Incorrect 120 ms 43044 KB Unexpected end of file - int32 expected
11 Incorrect 108 ms 43416 KB Unexpected end of file - int32 expected
12 Incorrect 95 ms 43468 KB Unexpected end of file - int32 expected
13 Incorrect 104 ms 43472 KB Unexpected end of file - int32 expected
14 Incorrect 96 ms 43408 KB not a zalsequence