結果

問題 No.688 E869120 and Constructing Array 2
ユーザー nmnmnmnmnmnmnmnmnmnmnmnmnmnm
提出日時 2018-05-19 00:17:39
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,491 bytes
コンパイル時間 704 ms
コンパイル使用メモリ 94,740 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-21 20:11:37
合計ジャッジ時間 3,139 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main() {
  ll k;
  cin>>k;
  if(k==0){
    cout << 1 << endl;
    cout << 0 << endl;
    return 0;
  }
  vector<pair<ll,ll> > v;
  rep(i,2,31){
    v.pb(mp(i*(i-1)/2,i));
  }
  rep(i,0,v.sz){
    if(k%v[i].fi==0){
      ll k1 = k/v[i].fi;
      ll c = 0;
      rep(j,0,100){
        if(k1%2==0){
          k1/=2;
          c++;
        }
      }
      if(k1==1){
        vector<ll> ans;
        rep(j,0,v[i].se){
          ans.pb(1);
        }
        rep(j,0,c){
          ans.pb(0);
        }
        if(ans.sz<=30){
          rep(i,0,ans.sz){
            cout << ans[i];
            if(i!=ans.sz-1)cout << " ";
          }
          cout << endl;
          return 0;
        }
      }
    }
  }
  return 0;
}
0