結果

問題 No.1528 Not 1
ユーザー Fu_LFu_L
提出日時 2024-02-25 23:48:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 1,040 bytes
コンパイル時間 2,861 ms
コンパイル使用メモリ 205,232 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-25 23:48:48
合計ジャッジ時間 4,332 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 7 ms
6,676 KB
testcase_02 AC 4 ms
6,676 KB
testcase_03 AC 4 ms
6,676 KB
testcase_04 AC 7 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 6 ms
6,676 KB
testcase_07 AC 7 ms
6,676 KB
testcase_08 AC 5 ms
6,676 KB
testcase_09 AC 3 ms
6,676 KB
testcase_10 AC 4 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 8 ms
6,676 KB
testcase_19 AC 8 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, a, b) for(ll i = a; i < b; ++i)
#define rrep(i, a, b) for(ll i = a; i >= b; --i)
constexpr ll inf = 4e18;
struct SetupIO {
    SetupIO() {
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout << fixed << setprecision(30);
    }
} setup_io;
int main(void) {
    int n;
    cin >> n;
    if(n == 3 or n == 5) {
        cout << -1 << '\n';
    } else if(n == 1) {
        cout << 1 << '\n';
    } else if(n == 7) {
        cout << "2 4 6 3" << '\n';
    } else if(n == 9) {
        cout << "2 4 6 3 9" << '\n';
    } else if(n == 11) {
        cout << "3 9 6 2 10 5" << '\n';
    } else {
        vector<int> ans(n / 2);
        rep(i, 0, n / 2) {
            ans[i] = 2 * (i + 1);
        }
        if(n % 2 == 1) {
            swap(ans[1], ans[5]);
            ans.insert(ans.begin() + 2, 3);
        }
        rep(i, 0, (int)ans.size()) {
            cout << ans[i] << " \n"[i + 1 == (int)ans.size()];
        }
    }
}
0