Submission #843194

# Submission time Handle Problem Language Result Execution time Memory
843194 2023-09-03T19:06:02 Z Elvin_Fritl Zalmoxis (BOI18_zalmoxis) C++17
35 / 100
1000 ms 65856 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1e6 + 66;

vector<int> v[N] , a(N);

void func(int x , int k){
    if(k == 0 || x == 0){
        cout<<x<<" ";
        return;
    }
    k--;
    func(x-1 ,k);
    func(x-1 ,k);
}

int32_t main()
{
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    a[n] = 30;
    int cem = 0;
    for(int i=0;i<n;i++){
        cem += (1<<a[i]);
        assert(k >= 0);
        while(__builtin_ctz(cem) < a[i+1]){
            v[i].push_back(__builtin_ctz(cem));
            cem += (cem & -cem);
            k--;
        }
    }

    for(int i=0;i<n;i++){
        cout << a[i] << " ";
        for(int x : v[i]){
            func(x, k);
        }
    }

}
/*

1 1    2 2    3 3    4 4
1


*/
# Verdict Execution time Memory Grader output
1 Correct 177 ms 29868 KB Output is correct
2 Correct 175 ms 29888 KB Output is correct
3 Correct 177 ms 29776 KB Output is correct
4 Correct 184 ms 29868 KB Output is correct
5 Correct 168 ms 29860 KB Output is correct
6 Correct 172 ms 29776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 389 ms 37200 KB Expected EOF
2 Correct 172 ms 29788 KB Output is correct
3 Incorrect 177 ms 29940 KB Expected EOF
4 Incorrect 636 ms 45880 KB Expected EOF
5 Incorrect 268 ms 32900 KB Expected EOF
6 Incorrect 357 ms 36476 KB Expected EOF
7 Incorrect 443 ms 39612 KB Expected EOF
8 Incorrect 212 ms 31056 KB Expected EOF
9 Execution timed out 1053 ms 64400 KB Time limit exceeded
10 Execution timed out 1048 ms 65856 KB Time limit exceeded
11 Execution timed out 1041 ms 64460 KB Time limit exceeded
12 Execution timed out 1036 ms 64064 KB Time limit exceeded
13 Execution timed out 1058 ms 64048 KB Time limit exceeded
14 Execution timed out 1035 ms 64236 KB Time limit exceeded