結果
問題 | No.1528 Not 1 |
ユーザー |
|
提出日時 | 2021-06-04 20:11:44 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 625 bytes |
コンパイル時間 | 2,084 ms |
コンパイル使用メモリ | 193,972 KB |
最終ジャッジ日時 | 2025-01-21 21:37:41 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>int main() {int N; std::cin >> N;int M = (N + 1) / 2;std::vector<int> A(M);bool ok = true;if (N % 2 == 0) {for (int i = 0; i < M; ++i) {A[i] = 2 * (i + 1);}}else {if (N == 1) A[0] = 1;else if (N == 3 or N == 5) ok = false;else {for (int i = 0; i < M - 1; ++i) A[i] = 2 * (i + 1);std::swap(A[2], A[M - 2]);A.back() = 3;}}if (ok) {for (int i = 0; i < M; ++i) {if (i) std::cout << " ";std::cout << A[i];}std::cout << "\n";}else {std::cout << -1 << "\n";}return 0;}