Submission #954990
Source Code Expand
//Daniel Grzegorzewski #include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ST first #define ND second using namespace std; typedef pair<int, int> PII; typedef vector<int> VI; typedef vector<PII> VII; typedef long long LL; void init_ios() { ios_base::sync_with_stdio(0); cin.tie(0); } const int N = 3*(int)1e5+10; bool used[N]; int res[N], n, x; int main() { init_ios(); cin >> n >> x; if (n == 2) { if (x != 2) { cout<<"No\n"; return 0; } cout<<"Yes\n1\n2\n3\n"; return 0; } n = 2*n-1; if (x == 1 || x == n) { cout<<"No\n"; return 0; } res[n/2] = x; res[n/2-1] = x-1; res[n/2+1] = x+1; used[x] = used[x-1] = used[x+1] = true; int nr = 1; for (int i = 0; i < n; ++i) { if (res[i] == 0) { while (used[nr]) ++nr; res[i] = nr++; } } cout<<"Yes\n"; for (int i = 0; i < n; ++i) cout<<res[i]<<"\n"; }
Submission Info
Submission Time | |
---|---|
Task | B - Median Pyramid Easy |
User | Vax |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1029 Byte |
Status | AC |
Exec Time | 20 ms |
Memory | 2304 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 | 2 ms | 256 KB |
0_01.txt | AC | 2 ms | 256 KB |
1_00.txt | AC | 2 ms | 256 KB |
1_01.txt | AC | 2 ms | 256 KB |
1_02.txt | AC | 2 ms | 256 KB |
1_03.txt | AC | 2 ms | 256 KB |
1_04.txt | AC | 2 ms | 384 KB |
1_05.txt | AC | 2 ms | 256 KB |
1_06.txt | AC | 2 ms | 256 KB |
1_07.txt | AC | 2 ms | 256 KB |
1_08.txt | AC | 2 ms | 256 KB |
1_09.txt | AC | 20 ms | 2304 KB |
1_10.txt | AC | 20 ms | 2304 KB |
1_11.txt | AC | 20 ms | 2304 KB |
1_12.txt | AC | 20 ms | 2304 KB |
1_13.txt | AC | 20 ms | 2304 KB |
1_14.txt | AC | 2 ms | 256 KB |
1_15.txt | AC | 2 ms | 256 KB |
1_16.txt | AC | 12 ms | 1408 KB |
1_17.txt | AC | 19 ms | 2304 KB |
1_18.txt | AC | 9 ms | 1024 KB |
1_19.txt | AC | 2 ms | 256 KB |