結果
| 問題 |
No.2608 Divide into two
|
| コンテスト | |
| ユーザー |
shisidor
|
| 提出日時 | 2024-01-19 21:33:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 1,923 ms |
| コンパイル使用メモリ | 167,352 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-28 04:03:11 |
| 合計ジャッジ時間 | 1,941 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
for (int j = 0; j < t; j++) {
int n;
cin >> n;
if ((n * (n + 1) / 2 % 2) == 1) cout << -1 << endl;
else {
int x = (n + 1) * n / 4;
vector<int> res(n + 1, 0);
for (int i = n; i >= 1; i--) {
if (x >= i) {
res[i]++;
x -= i;
}
}
for (int i = 1; i <= n; i++) {
cout << res[i];
if (i == n) cout << endl;
}
}
}
}
shisidor