結果
問題 |
No.3267 PQ Straight
|
ユーザー |
![]() |
提出日時 | 2025-09-12 22:44:46 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 35 ms / 1,000 ms |
コード長 | 1,041 bytes |
コンパイル時間 | 5,746 ms |
コンパイル使用メモリ | 334,884 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-12 23:43:01 |
合計ジャッジ時間 | 8,014 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using i32 = int; using u32 = unsigned int; using i64 = long long; using u64 = unsigned long long; #define FAST_IO \ ios::sync_with_stdio(false); \ cin.tie(0); const i64 INF = 1001001001001001001; using Modint = atcoder::static_modint<998244353>; int main() { FAST_IO int N; cin >> N; // 1 2 3 4 ... N // (a + a + N - 1) * N / 2 = N * (N + 1) // 2a + N - 1 = 2(N + 1) // 2a = N + 3 // a = (N + 3) / 2 // N = 5 // a = 4 // 1 3 5 2 4 // 3 2 1 5 4 if (N % 2 == 0) { cout << "No" << endl; return 0; } cout << "Yes" << endl; int a = (N + 3) / 2; vector<int> ans1, ans2; for (int i = 1; i <= N; i += 2) { ans1.push_back(i); ans2.push_back(a - i); a ++; } for (int i = 2; i <= N; i += 2) { ans1.push_back(i); ans2.push_back(a - i); a ++; } for(auto &v : ans1) { cout << v << " "; } cout << endl; for(auto &v : ans2) { cout << v << " "; } cout << endl; }