結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kotatsugamekotatsugame
提出日時 2018-06-15 03:02:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 321 bytes
コンパイル時間 443 ms
コンパイル使用メモリ 64,592 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-21 20:54:16
合計ジャッジ時間 3,261 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,756 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int k;
main()
{
	cin>>k;
	for(int i=2;;i++)
	{
		int n=i*(i-1)/2;
		if(k%n==0&&__builtin_popcount(k/n)==1)
		{
			int l=__builtin_ctz(k/n);
			cout<<i+l<<endl;
			cout<<1;
			for(int j=0;j<i-1;j++)cout<<" 1";
			for(int j=0;j<l;j++)cout<<" 0";
			cout<<endl;
			return 0;
		}
	}
}
0