結果

問題 No.2608 Divide into two
ユーザー kokoseikokosei
提出日時 2024-03-12 08:03:21
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 660 bytes
コンパイル時間 3,227 ms
コンパイル使用メモリ 247,036 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-03-12 08:03:25
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 <bits/stdc++.h>
using namespace std;
using ll = long long;

int N;
string repeat(string s, int n){
    string res;
    while(n--)res += s;
    return res;
}
void solve(){
    cin >> N;
    if(N % 4 == 0){
        cout << repeat("01", N / 4);
        cout << repeat("10", N / 4);
        cout << "\n";
    }else if((N + 1) % 4 == 0){
        cout << "110";
        N -= 3;
        cout << repeat("01", N / 4);
        cout << repeat("10", N / 4);
        cout << "\n";
    }else{
        cout << -1 << "\n";
    }
}
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t; cin >> t;
    while(t--)solve();

    return 0;
}
0