結果

問題 No.3287 Golden Ring
ユーザー ロロット
提出日時 2025-10-04 01:12:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 2,773 ms
コンパイル使用メモリ 278,220 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-04 01:12:59
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define ALL(a) (a).begin(), (a).end()
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    if (N == 2) {
        No;
        return 0;
    }
    vector<int> ans(N);
    for (int i = 0; i < N; i++) {
        ans[i] = i + 1;
    }
    if (N % 2 == 0)
        swap(ans[N - 2], ans[N - 1]);
    Yes;
    for (auto x : ans)
        cout << x << ' ';
    cout << endl;
}
0