結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| ユーザー |
yosupot
|
| 提出日時 | 2018-05-18 23:28:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,278 bytes |
| コンパイル時間 | 963 ms |
| コンパイル使用メモリ | 109,360 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-07 13:39:19 |
| 合計ジャッジ時間 | 1,659 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
int main() {
ll k;
cin >> k;
if (k == 0) {
//ここいる?
cout << 1 << endl;
cout << 0 << endl;
return 0;
}
for (int n = 2; n <= 30; n++) {
for (int a = 0; a <= n-2; a++) {
int b = n-a;
ll z = b*(b-1) / 2;
for (int i = 0; i < a; i++) {
z *= 2;
}
if (k == z) {
cout << n << endl;
for (int i = 0; i < a; i++) {
cout << 0 << " ";
}
for (int i = a; i < n; i++) {
cout << 1 << " ";
}
cout << endl;
}
}
}
return 0;
}
yosupot