Submission #69113338


Source Code Expand

  #include "atcoder/all"
  //#include "atcoder/modint"
  //#pragma GCC optimize("Ofast")
  #include <bits/stdc++.h>
  #include  <string>
  using namespace std;
  using namespace atcoder;
  #define int long long
    template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
  template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
  //const int MOD =1e9+7;
  //constexpr int MOD =10;
  constexpr int MOD =998244353;
  const long long M1=167772161,M2=469762049,M3=1224736769;
  //const int MOD =31607;
  using mint = static_modint<MOD>;
  //using mint = double;
  //using mint = modint;
  ostream& operator << (ostream& ost, const mint& m){ost << m.val();return ost;}
  istream& operator >> (istream& ost,  mint& m){int a;ost >> a;m=a;return ost;}
  double time_limit = 10.0,start_temp=5.0,end_temp=0.0;
  std::random_device seed_gen;
  std::mt19937 engine(seed_gen());

  signed main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    vector<int>b(1ll<<n,k/(1ll<<n));
    int ans=0;
    for(int i=n-1;i>=0;i--)if(k&(1ll<<i)){
      for(int j=0;j<(1ll<<n);j++)if(j%(1ll<<(n-i))==(1ll<<(n-1-i)))b[j]++,ans=1;
    }
    cout<<ans<<endl;
    for(int i=0;i<(1ll<<n);i++)cout<<b[i]<<" ";
    cout<<endl;
    return 0;
    

    
  }

Submission Info

Submission Time
Task D - Least Unbalanced
User yatuba
Language C++ 20 (gcc 12.2)
Score 400
Code Size 1376 Byte
Status AC
Exec Time 94 ms
Memory 12808 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 3600 KiB
00_sample_01.txt AC 1 ms 3652 KiB
01_random_00.txt AC 1 ms 3452 KiB
01_random_01.txt AC 1 ms 3600 KiB
01_random_02.txt AC 1 ms 3604 KiB
01_random_03.txt AC 1 ms 3536 KiB
01_random_04.txt AC 1 ms 3536 KiB
01_random_05.txt AC 1 ms 3724 KiB
01_random_06.txt AC 1 ms 3584 KiB
01_random_07.txt AC 1 ms 3588 KiB
01_random_08.txt AC 1 ms 3524 KiB
01_random_09.txt AC 1 ms 3612 KiB
01_random_10.txt AC 1 ms 3600 KiB
01_random_11.txt AC 1 ms 3484 KiB
01_random_12.txt AC 2 ms 3652 KiB
01_random_13.txt AC 2 ms 3584 KiB
01_random_14.txt AC 4 ms 3648 KiB
01_random_15.txt AC 7 ms 3720 KiB
01_random_16.txt AC 9 ms 4248 KiB
01_random_17.txt AC 25 ms 5376 KiB
01_random_18.txt AC 44 ms 7416 KiB
01_random_19.txt AC 94 ms 12808 KiB
01_random_20.txt AC 1 ms 3492 KiB
01_random_21.txt AC 5 ms 3628 KiB
01_random_22.txt AC 1 ms 3728 KiB