Submission #3386895


Source Code Expand

Copy
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int N, x;
  cin >> N >> x;
  vector<int> ans(2*N-1);
  if(x < 2 or x == 2*N-1){
    cout << "No" << endl;
    return 0;
  }
  int m = (2*N-1)/2;
  ans[m] = x;
  ans[m-1] = 2*N-1;
  ans[m+1] = 1;
  int l = 2, r = 2*N-2;
  for(int i = 0; i < m-1; ++i){
    if(l == x) ++l;
    if(r == x) --r;
    ans[i] = l;
    ans[m+2+i] = r;
    --r;
    ++l;
  }
  cout << "Yes" << endl;
  for(int i = 0; i < 2*N-1; ++i) cout << ans[i] << endl;
  return 0;
}

Submission Info

Submission Time
Task B - Median Pyramid Easy
User TAB
Language C++14 (GCC 5.4.1)
Score 400
Code Size 548 Byte
Status
Exec Time 317 ms
Memory 2304 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt
All 400 / 400 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 1 ms 256 KB
0_01.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 1 ms 256 KB
1_03.txt 1 ms 256 KB
1_04.txt 1 ms 256 KB
1_05.txt 1 ms 256 KB
1_06.txt 1 ms 256 KB
1_07.txt 1 ms 256 KB
1_08.txt 2 ms 1024 KB
1_09.txt 305 ms 2304 KB
1_10.txt 307 ms 2304 KB
1_11.txt 303 ms 2304 KB
1_12.txt 301 ms 2304 KB
1_13.txt 317 ms 2304 KB
1_14.txt 2 ms 1024 KB
1_15.txt 1 ms 384 KB
1_16.txt 179 ms 1408 KB
1_17.txt 296 ms 2176 KB
1_18.txt 128 ms 1024 KB
1_19.txt 1 ms 512 KB