結果

問題 No.2608 Divide into two
ユーザー matcharate12matcharate12
提出日時 2024-02-26 20:23:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,246 bytes
コンパイル時間 1,613 ms
コンパイル使用メモリ 168,544 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-26 20:23:15
合計ジャッジ時間 2,074 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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>
#define rep(i,n) for(ll i = 0; i < n; i++) //[0,n)
#define srep(i,a,b) for(ll i = a; i < b; i++) //[a,b)
#define all(A) (A).begin(),(A).end()
#define rall(A) (A).rbegin(),(A).rend()
#define pmt(A) next_permutation(all(A))
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<ll,ll>;
using pq = priority_queue<P,vector<P>,greater<P>>;
const ll inf = 1LL<<60;
const int iinf = (int)1e9+1;
const int mod9 = 998244353;
const int mod1 = 1000000007;
struct Edge { int to; long long cost; int from; };
bool compe(const Edge &e,const Edge &e2){ return e.cost < e2.cost; }
using Graph = vector<vector<int>>;
using SGraph = vector<set<ll>>;
template <class T>
int siz(T& a){return (int)a.size();}
ll squa(ll a){ return a*a; }
ll mceil(ll a,ll b){ return (a+b-1)/b; }

int main(void){
    int T; cin >> T;
    while(T--){
        int N; cin >> N;
        ll n = N*(N+1)/2;

        if(n%2 == 1) cout << -1 << endl;
        else {
            string ans = "";
            ll res = n/2;

            rep(i,N){
                if(res-(N-i) >= 0) ans += "1",res -= N-i;
                else ans += "0";
            }
            reverse(all(ans));
            cout << ans << endl;
        }
    }
}
0