結果

問題 No.2608 Divide into two
ユーザー 👑 hitonanodehitonanode
提出日時 2024-01-19 22:48:18
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 757 bytes
コンパイル時間 687 ms
コンパイル使用メモリ 79,856 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-19 22:48:20
合計ジャッジ時間 1,152 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define REP(i, n) FOR(i,0,n)

int main() {
    int T;
    cin >> T;
    while (T--) {
        int N;
        cin >> N;

        const int sum = (1 + N) * N / 2;

        auto solve = [&]() -> string {
            if (sum % 2) return "-1";
            if (N % 4 == 0) {
                string ret;
                REP(_, N / 4) ret += "1001";
                return ret;
            }

            if (N % 4 == 3) {
                string ret = "110";
                REP(_, N / 4) ret += "1001";
                return ret;
            }

            throw;
        };

        cout << solve() << '\n';
    }
}
0