結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
kokosei
|
| 提出日時 | 2024-03-12 08:03:21 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 660 bytes |
| コンパイル時間 | 2,980 ms |
| コンパイル使用メモリ | 245,664 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-09-29 22:11:19 |
| 合計ジャッジ時間 | 3,537 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#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;
}
kokosei