結果

問題 No.688 E869120 and Constructing Array 2
ユーザー 夜
提出日時 2020-10-27 11:55:50
言語 C++14
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 809µs
コード長 784 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 536 ms
コンパイル使用メモリ 111,320 KB
実行使用メモリ 9,856 KB
最終ジャッジ日時 2026-10-31 09:46:07
合計ジャッジ時間 2,078 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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