結果

問題 No.2608 Divide into two
ユーザー YwestbuilderkYwestbuilderk
提出日時 2024-01-22 18:52:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 724 ms
コンパイル使用メモリ 77,240 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-01-22 18:52:53
合計ジャッジ時間 1,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(){
	int t;
	cin >> t;
	for(int i = 0;i < t;i++){
		int k;
		cin >> k;
		int wa = k * (k + 1);
		if(wa % 4 != 0) cout << -1 << endl;
		else{
			wa %= 4;
			int hi = k;
			set<int> s;
			while(wa > 0){
				if(wa <= hi){
					s.insert(wa);
					break;
				}
				else{
					s.insert(hi);
					wa -= hi;
					hi--;
				}
			}
			for(int i = 1;i <= k;i++){
				if(s.find(i) != s.end()) cout << 1;
				else cout << 0;
			}
		}
	}
}
0