Submission #2545510
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,n) for (int i = a; i < (int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define whole(f,x,...) ([&](decltype((x)) whole) { \
return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
template<typename T> bool chmin(T &a, const T &b) {if (a > b) { a = b; return true; }return false;}
template<typename T> bool chmax(T &a, const T &b) {if (a < b) { a = b; return true; }return false;}
using ll = int_fast64_t;
constexpr ll INF = (1e9);
constexpr ll MOD = (1e9+7);
int main() {
ll n, x; cin >> n >> x;
vector<ll> ans(2*n-1);
if (x == 1 || x == 2*n-1) {
cout << "No" << endl;
return 0;
}
if (n == 2) {
cout << "Yes" << endl;
cout << 1 << endl << 2 << endl << 3 << endl;
return 0;
}
if (x == 2) {
ans[n-2] = 3, ans[n-1] = 2, ans[n] = 1, ans[n+1] = 4;
FOR(i,5,2*n) {
if (i-1 <= n+1) ans[i-5] = i;
else ans[i-1] = i;
}
} else {
ans[n-2] = x-1, ans[n-1] = x, ans[n] = x+1, ans[n+1] = x-2;
FOR(i,1,2*n) {
if (x-2 <= i && i <= x+1) continue;
if (i < x-2 && i-1 < n-2) ans[i-1] = i;
else if (i < x-2) ans[i+3] = i;
else if (i-1 <= n+1) ans[i-5] = i;
else ans[i-1] = i;
}
}
cout << "Yes" << endl;
REP(i,ans.size()) cout << ans[i] << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
B - Median Pyramid Easy |
User |
sunao |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
1360 Byte |
Status |
AC |
Exec Time |
316 ms |
Memory |
3072 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
0_00.txt, 0_01.txt |
All |
0_00.txt, 0_01.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt |
Case Name |
Status |
Exec Time |
Memory |
0_00.txt |
AC |
1 ms |
256 KB |
0_01.txt |
AC |
1 ms |
256 KB |
1_00.txt |
AC |
1 ms |
256 KB |
1_01.txt |
AC |
1 ms |
256 KB |
1_02.txt |
AC |
1 ms |
256 KB |
1_03.txt |
AC |
1 ms |
256 KB |
1_04.txt |
AC |
1 ms |
256 KB |
1_05.txt |
AC |
1 ms |
256 KB |
1_06.txt |
AC |
1 ms |
256 KB |
1_07.txt |
AC |
1 ms |
256 KB |
1_08.txt |
AC |
2 ms |
1792 KB |
1_09.txt |
AC |
302 ms |
3072 KB |
1_10.txt |
AC |
307 ms |
3072 KB |
1_11.txt |
AC |
316 ms |
3072 KB |
1_12.txt |
AC |
298 ms |
3072 KB |
1_13.txt |
AC |
305 ms |
3072 KB |
1_14.txt |
AC |
2 ms |
1792 KB |
1_15.txt |
AC |
1 ms |
512 KB |
1_16.txt |
AC |
175 ms |
1792 KB |
1_17.txt |
AC |
294 ms |
2944 KB |
1_18.txt |
AC |
124 ms |
1408 KB |
1_19.txt |
AC |
1 ms |
640 KB |