結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-19 22:44:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 620 bytes |
| コンパイル時間 | 1,963 ms |
| コンパイル使用メモリ | 167,684 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-28 04:53:03 |
| 合計ジャッジ時間 | 2,026 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i=0;i<ll(n);i++)
int main(void){
cin.tie(nullptr); ios_base::sync_with_stdio(false);
ll i,j,k;
int T;
cin >> T;
while(T--){
int N;
cin >> N;
if((N*(N+1)/2)%2==1){
cout << -1 << endl;
continue;
}
int s=N*(N+1)/4;
string x(N,'0');
int a=0,p=-1;
for(i=N;i>=1;i--){
if(a+i<=s){
a+=i;
x[i-1]='1';
}
else{
p=i;
break;
}
}
for(i=p;i>=1;i--){
if(a+i==s){
x[i-1]='1';
break;
}
}
cout << x << endl;
}
return 0;
}