結果

問題 No.688 E869120 and Constructing Array 2
ユーザー ahe100ahe100
提出日時 2018-06-05 23:49:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 915 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 71,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-21 20:48:03
合計ジャッジ時間 1,296 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//WA

int main(void){
	bool can=false;
	int K;
	cin>>K;
	reg(b,0,30){
		reg(a,0,30-b){
			if(a==0 && b==0)continue;
			ll c=1;
			rep(i,a)c*=2;
			c*=b*(b-1)/2;
			if(c==K){
				printf("%d\n",a+b);
				rep(j,a){
					printf("0");
					if(b!=0)printf(" ");
				}
				rep(j,b){
					printf("1");
					if(j!=b-1)printf(" ");
				}
				printf("\n");
				return 0;
			}
		}
	}
}
0