結果

問題 No.2608 Divide into two
ユーザー eve__fuyuki
提出日時 2024-01-20 12:02:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 704 bytes
コンパイル時間 1,987 ms
コンパイル使用メモリ 192,340 KB
最終ジャッジ日時 2025-02-18 21:50:17
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
}

int main() {
    fast_io();
    int t;
    cin >> t;
    for (; t--;) {
        int n;
        cin >> n;
        if (n % 4 == 0) {
            string ans(n, '0');
            for (int i = 0; i < n / 4; i++) {
                ans[i] = ans[n - i - 1] = '1';
            }
            cout << ans << "\n";
        } else if (n % 4 == 3) {
            string ans(n, '0');
            for (int i = 0; i < (n + 1) / 4; i++) {
                ans[i] = ans[n - i - 2] = '1';
            }
            cout << ans << "\n";
        } else {
            cout << "-1\n";
        }
    }
}
0