結果

問題 No.1528 Not 1
ユーザー ytqm3ytqm3
提出日時 2021-07-22 14:18:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,689 bytes
コンパイル時間 2,027 ms
コンパイル使用メモリ 203,452 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-24 13:58:22
合計ジャッジ時間 4,195 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 7 ms
4,376 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 5 ms
4,376 KB
testcase_04 AC 8 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
typedef uint64_t u64;
typedef int64_t i64;
typedef long double f128;
using namespace std;

template<u64 mod>
struct modint{
  u64 val;
  constexpr modint(const i64 x=0) noexcept:val((x%i64(mod)+i64(mod))%i64(mod)){}
  constexpr u64 get_mod() const noexcept{
    return mod;
  }
  constexpr modint operator+(const modint rhs) const noexcept{
    return modint(*this)+=rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept{
    return modint(*this)-=rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept{
    return modint(*this)*=rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept{
    return modint(*this)/=rhs;
  }
  constexpr modint &operator+=(const modint rhs) noexcept{
    val+=rhs.val;
    val-=((val>=mod)?mod:0);
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept{
    val+=((val<rhs.val)?mod:0);
    val-=rhs.val;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept{
    val=val*rhs.val%mod;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept{
    u64 exp=mod-2;
    while(exp){
      if(exp&1){
        (*this)*=rhs;
      }
      rhs*=rhs;
      exp>>=1;
    }
    return *this;
  }
  friend constexpr ostream &operator<<(ostream &os,const modint &x) noexcept{
    return os<<(x.val);
  }
  friend constexpr istream &operator>>(istream &is,modint &x) noexcept{
    u64 t;
    is>>t;
    x=t;
    return is;
  }
};

void scan(){}

template<typename T,class... Args>
void scan(T& n,Args&... args){
  cin>>n;
  scan(args...);
}

template<typename T>
void scanall(T start,T end){
  for(;start!=end;++start){
    scan(*start);
  }
}

void print(){}

template<typename T,class... Args>
void print(T n,Args... args){
  cout<<n;
  print(args...);
}

template<typename T>
void println(T n){
  cout<<n<<endl;
}

template<typename T,class... Args>
void println(T n,Args... args){
  cout<<n<<' ';
  println(args...);
}

template<typename T>
void printall(T start,T end){
  if(start!=end){
    cout<<(*start);
    for(++start;start!=end;++start){
      cout<<' '<<(*start);
    }
  }
  cout<<endl;
}

template<typename T>
void chmax(T& n,T m){
  n=max(n,m);
}

template<typename T>
void chmin(T& n,T m){
  n=min(n,m);
}

template<typename T,typename U>
T power(T a,U n){
  T res=1;
  while(n){
    res*=((n&1)?a:1);
    a*=a;
    n>>=1;
  }
  return res;
}

i64 power(i64 a,i64 n,i64 m){
  i64 res=1%m;
  while(n){
    if(n&1){
      res=res*a%m;
    }
    a=a*a%m;
    n>>=1;
  }
  return res;
}

template<typename T>
struct combination{
  vector<T> fact,fact_inv;
  combination(int mx=3000000):fact(mx+1,1),fact_inv(mx+1,1){
    for(int i=2;i<=mx;++i){
      fact[i]=fact[i-1]*i;
    }
    fact_inv[mx]/=fact[mx];
    for(int i=mx;i>0;--i){
      fact_inv[i-1]=fact_inv[i]*i;
    }
  }
  template<typename U>
  T nCk(U n,U k){
    if(n<k||n<0||k<0){
      return 0;
    }
    return fact[n]*fact_inv[k]*fact_inv[n-k];
  }
};


void solve();

int main(){
  cout<<fixed<<setprecision(15);
  bool is_multicase=false;
  int T=1;
  if(is_multicase){
    scan(T);
  }
  for(int i=0;i<T;++i){
    solve();
  }
  return 0;
}

void solve(){
  int N;
  scan(N);
  if(N==1){
    println(1);
    return;
  }
  vector<int> ans(N/2);
  for(int i=0;i<N/2;++i){
    ans[i]=2*(i+1);
  }
  if(N%2==0){
    printall(ans.begin(),ans.end());
    return;
  }
  int now=N-1;
  while(now%2==0){
    ans[(now-2)/2]=-1;
    now/=2;
  }
  vector<int> ans2;
  for(int v:ans){
    if(v!=-1){
      ans2.emplace_back(v);
    }
  }
  now=N-1;
  while(int(ans2.size())!=(N+1)/2){
    ans2.emplace_back(now);
    now/=2;
  }
  printall(ans2.begin(),ans2.end());
}
0