結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-19 22:28:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 903 bytes |
| コンパイル時間 | 613 ms |
| コンパイル使用メモリ | 69,156 KB |
| 実行使用メモリ | 6,940 KB |
| 最終ジャッジ日時 | 2024-09-28 04:45:25 |
| 合計ジャッジ時間 | 1,159 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int T;
cin >> T;
while (T--)
{
int N;
cin >> N;
int n = 0;
for (int i = 0; i <= N; i++)
{
n += i;
}
if (n % 2 == 0)
{
vector<bool> B(N, false);
int s = n / 2;
for (int i = N; i > 0; i--)
{
if (s >= i)
{
s -= i;
B[i - 1] = true;
}
}
for (int i = 0; i < N; i++)
{
if (B[i])
{
cout << 1;
}
else
{
cout << 0;
}
}
cout << endl;
}
else
{
cout << -1 << endl;
}
}
}