結果
| 問題 | No.3287 Golden Ring | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-10-03 21:25:56 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 694 bytes | 
| コンパイル時間 | 1,716 ms | 
| コンパイル使用メモリ | 196,016 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-10-03 21:25:59 | 
| 合計ジャッジ時間 | 2,780 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 14 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    if(n == 2){
        cout << "No\n";
        return 0;
    }
    if(n % 2 == 1){
        cout << "Yes\n";
        for(int i = 1; i <= n; i++){
            cout << i << (i == n ? '\n' : ' ');
        }
    }else{
        // 1 2 3 4
        // 1 3 2 4
        cout << "Yes\n";
        vector<int> ans;
        for(int i = 1; i <= n; i += 2) ans.emplace_back(i);
        for(int i = n / 2 * 2; i >= 1; i -= 2) ans.emplace_back(i);
        for(int i = 0; i < ans.size(); i++){
            cout << ans[i] << (i + 1 == ans.size() ? '\n' : ' ');
        }
    }
}
            
            
            
        