結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-01-19 21:33:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 623 bytes |
| コンパイル時間 | 1,884 ms |
| コンパイル使用メモリ | 193,200 KB |
| 最終ジャッジ日時 | 2025-02-18 20:45:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 1 |
ソースコード
#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;
int main() {
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
int M = N * (N + 1) / 2;
if (M % 2 == 1) {
cout << -1 << endl;
} else {
M /= 2;
int now = 0, sum = 0;
vector<char> ans(N, '0');
while (sum + now + 1 <= M) {
now++;
sum += now;
ans[now - 1] = '1';
}
if (sum < M) {
int d = M - sum;
ans[N - d - 1] = '0';
ans[N - 1] = '1';
}
for (int i = 0; i < N; i++) cout << ans[i];
cout << endl;
}
}
}
Today03