結果

問題 No.3267 PQ Straight
ユーザー GOTKAKO
提出日時 2025-09-12 23:35:32
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 2,105 ms
コンパイル使用メモリ 198,548 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-09-12 23:45:15
合計ジャッジ時間 6,089 ms
ジャッジサーバーID
(参考情報)
judge6 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    if(N%2 == 0){cout << "No\n"; return 0;}
    int x = 1,y = 2;
    vector<int> P = {x},Q = {y};
    for(int i=0; i<N-1; i+=2){
        x += 2,y--;
        P.push_back(x),Q.push_back(y);
        x--,y += 2;
        P.push_back(x),Q.push_back(y);
    }

    int back = P.at(0)+Q.at(0);
    for(int i=1; i<N; i++){
        int now = P.at(i)+Q.at(i);
        if(now-back != 1){assert(false); break;}
        back = now;
    }
    cout << "Yes\n";
    for(auto &p : P) cout << p << " "; cout << endl;
    for(auto &q : Q) cout << q << " "; cout << endl;

}
0