Submission #69174256


Source Code Expand

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef tuple<int, int, int> ti;
typedef vector<bool> vb;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> OS;
//FOR BLITZ READING INPUT/OUTPUT TEXT FILES
//ifstream fin("input.txt");
//ofstream fout("output.txt");
//IF USING ABOVE, USE 'fin' AND 'fout' INSTEAD OF 'cin' AND 'cout' !!!!!!

void solve() {
    int n, k;
    cin >> n >> k;
    int tot = 1 << n;
    int avg = k / tot;
    vll res(tot, avg);
    int extra = k % tot;
    int num = 0;
    if (extra != 0) {
        num = 1;
        int cur = 1;
        int bs = tot;
        while (cur < extra) {
            cur <<= 1;
            bs >>= 1;
        }
        for (int i = 0; i < extra; i++) res[bs * i]++;
    }
    cout << num << endl;
    for (auto x: res) cout << x << " ";
    cout << endl;
}

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int test = 1;
    //cin >> test;
    for (int t = 0; t < test; t++) {
        solve();
    }
}

Submission Info

Submission Time
Task D - Least Unbalanced
User rensdebot73
Language C++ 20 (gcc 12.2)
Score 0
Code Size 1450 Byte
Status WA
Exec Time 47 ms
Memory 12828 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 13
WA × 12
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3448 KiB
00_sample_01.txt AC 1 ms 3400 KiB
01_random_00.txt AC 1 ms 3344 KiB
01_random_01.txt AC 1 ms 3488 KiB
01_random_02.txt AC 1 ms 3484 KiB
01_random_03.txt AC 1 ms 3412 KiB
01_random_04.txt AC 1 ms 3472 KiB
01_random_05.txt WA 1 ms 3396 KiB
01_random_06.txt WA 1 ms 3544 KiB
01_random_07.txt WA 1 ms 3396 KiB
01_random_08.txt AC 1 ms 3472 KiB
01_random_09.txt WA 1 ms 3420 KiB
01_random_10.txt WA 1 ms 3404 KiB
01_random_11.txt WA 2 ms 3636 KiB
01_random_12.txt AC 2 ms 3464 KiB
01_random_13.txt WA 2 ms 3596 KiB
01_random_14.txt WA 3 ms 3472 KiB
01_random_15.txt WA 4 ms 3516 KiB
01_random_16.txt AC 8 ms 4172 KiB
01_random_17.txt WA 13 ms 5116 KiB
01_random_18.txt WA 24 ms 7208 KiB
01_random_19.txt WA 47 ms 12828 KiB
01_random_20.txt AC 2 ms 3540 KiB
01_random_21.txt AC 4 ms 3508 KiB
01_random_22.txt AC 1 ms 3388 KiB