結果

問題 No.688 E869120 and Constructing Array 2
ユーザー
提出日時 2020-10-27 11:55:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 784 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 92,272 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-21 21:53:15
合計ジャッジ時間 1,547 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	long long k;
	cin >> k;
	for (long long i = 1; i <= 30; i++) {
		for (long long j = 0; j < 32; j++) {
			long long co = i * (i - 1) / 2;
			for (int k = 0; k < j; k++) {
				co *= 2;
			}
			if (co == k) {
				cout << i + j << endl;
				for (int k = 0; k < i; k++) {
					cout << 1;
					if (k != i + j - 1) {
						cout << " ";
					}
				}
				for (int k = 0; k < j; k++) {
					cout << 0;
					if (k + i != i + j - 1) {
						cout << " ";
					}
				}
				return 0;
			}
		}
	}
}
0