結果

問題 No.3267 PQ Straight
ユーザー GOTKAKO
提出日時 2025-09-12 21:25:55
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 1,746 ms
コンパイル使用メモリ 198,208 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-12 23:34:17
合計ジャッジ時間 5,758 ms
ジャッジサーバーID
(参考情報)
judge5 / 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){cout << "Wrong" << endl; break;}
        back = now;
    }
    cout << "Yes\n";
    for(auto &p : P) cout << p << " "; cout << endl;
    for(auto &q : Q) cout << q << " "; cout << endl;

}
0