結果

問題 No.3267 PQ Straight
ユーザー cho435
提出日時 2025-09-12 21:42:49
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 34 ms / 1,000 ms
コード長 514 bytes
コンパイル時間 1,857 ms
コンパイル使用メモリ 196,028 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-12 23:36:51
合計ジャッジ時間 4,146 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = (s); i < ll(t); i++)

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) {
		cout << "No\n";
	} else {
		vector<int> p(n), q(n);
		rep(i, 0, n / 2 + 1) {
			p[i * 2] = i;
			q[i * 2] = n / 2 + i;
		}
		rep(i, 0, n / 2) {
			p[i * 2 + 1] = n / 2 + 1 + i;
			q[i * 2 + 1] = i;
		}
		cout << "Yes\n";
		for (int x : p) cout << x + 1 << ' ';
		cout << '\n';
		for (int x : q) cout << x + 1 << ' ';
		cout << '\n';
	}
}
0