Submission #69117721


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;//vvi vec(h, vi(w, n));
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vs = vector<string>;
using vvc = vector<vc>;
#define rep(i, a, n) for(ll i=(a); i<(ll)(n); ++i)
#define el '\n'
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define YES cout << "YES" << el
#define NO cout << "NO" << el
//cout << fixed << setprecision(10);

// abc422

int main(){
  ll n, k; cin >> n >> k;
  ll sizea=(1<<n);
  vll ans(sizea,-1);
  ans[0]=k;

  rep(i,0,n){
    vll tmp(1<<(i+1));
    ll j=0;
    while(ans[j]!=-1){
      tmp[2*j]=ans[j]/2;
      tmp[2*j+1]=ans[j]/2;
      if(ans[j]%2==1) ++tmp[2*j];
      ++j;
    }
    ans=tmp;
  }

  if(k%sizea==0) cout << 0 << el;
  else cout << 1 << el;
  
  rep(i,0,sizea){
    if(i!=0) cout << " ";
    cout << ans[i];
  }
  cout << el;
}

Submission Info

Submission Time
Task D - Least Unbalanced
User demado
Language C++ 23 (gcc 12.2)
Score 400
Code Size 979 Byte
Status AC
Exec Time 68 ms
Memory 19696 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 25
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 3496 KiB
00_sample_01.txt AC 1 ms 3532 KiB
01_random_00.txt AC 1 ms 3564 KiB
01_random_01.txt AC 1 ms 3532 KiB
01_random_02.txt AC 1 ms 3440 KiB
01_random_03.txt AC 1 ms 3536 KiB
01_random_04.txt AC 1 ms 3500 KiB
01_random_05.txt AC 1 ms 3568 KiB
01_random_06.txt AC 1 ms 3496 KiB
01_random_07.txt AC 1 ms 3460 KiB
01_random_08.txt AC 1 ms 3568 KiB
01_random_09.txt AC 1 ms 3468 KiB
01_random_10.txt AC 1 ms 3680 KiB
01_random_11.txt AC 1 ms 3528 KiB
01_random_12.txt AC 1 ms 3660 KiB
01_random_13.txt AC 2 ms 3544 KiB
01_random_14.txt AC 3 ms 3984 KiB
01_random_15.txt AC 5 ms 4084 KiB
01_random_16.txt AC 9 ms 5236 KiB
01_random_17.txt AC 18 ms 7220 KiB
01_random_18.txt AC 34 ms 11424 KiB
01_random_19.txt AC 68 ms 19696 KiB
01_random_20.txt AC 1 ms 3504 KiB
01_random_21.txt AC 5 ms 4200 KiB
01_random_22.txt AC 1 ms 3496 KiB