結果

問題 No.3287 Golden Ring
コンテスト
ユーザー vjudge1
提出日時 2025-11-05 00:52:17
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 5,094 ms
コンパイル使用メモリ 213,372 KB
実行使用メモリ 7,724 KB
最終ジャッジ日時 2025-11-05 00:52:25
合計ジャッジ時間 7,589 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main (void)
{
    int n;
    cin >> n;

    vector<int> vec(n);
    for (int i=0;i<n;i++)
        vec.at(i) = i+1;

    if (n == 2)
        cout << "no" <<endl;
    else 
    {
        cout << "yes"<<endl;
        if (n % 2 == 1)
        {
            for (auto i : vec)
                cout << i<<" ";
        }
        else
        {
             vector<int> odds, evens;
            for (int i = 1; i <= n; i += 2) odds.push_back(i); 
            for (int i = n; i >= 2; i -= 2) evens.push_back(i);   
            for (int x : odds) cout << x << " ";
            for (int x : evens) cout << x << " ";
        }
        cout << "\n";
    };

    return 0;
}
0