Submission #954998


Source Code Expand

#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	int N, x;
	const string ok = "Yes", ng = "No";
	cin >> N >> x;
	if(x == N*2-1 || x == 1) {
		cout << ng << endl;
		return 0;
	}
	if(N == 2) {
		cout << ok << endl;
		for(int i = 0; i < 2*N-1; i++) {
			cout << i+1 << endl;
		}
		return 0;
	}

	vector<int> a, b;
	a.resize(4);
	if(x == 2) {
		a[0] = x+1;
		a[1] = x;
		a[2] = x-1;
		a[3] = x+2;
	}
	else {
		a[0] = x-1;
		a[1] = x;
		a[2] = x+1;
		a[3] = x-2;
	}
	for(int i = 0; i < 2*N-1; i++) {
		if(x == 2) {
			if(!(x-1 <= i+1 && i+1 <= x+2))
				b.push_back(i+1);
			else
				b.push_back(a[i+1 - (x-1)]);
		}
		else {
			if(!(x-2 <= i+1 && i+1 <= x+1))
				b.push_back(i+1);
			else
				b.push_back(a[i+1 - (x-2)]);
		}
	}

	cout << ok << endl;
	for(int i = 0; i < b.size(); i++)
		cout << b[i] << endl;

	return 0;
}

Submission Info

Submission Time
Task B - Median Pyramid Easy
User konjo
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1786 Byte
Status WA
Exec Time 859 ms
Memory 2548 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 2
AC × 15
WA × 7
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 3 ms 256 KB
0_01.txt AC 3 ms 256 KB
1_00.txt AC 3 ms 256 KB
1_01.txt AC 3 ms 256 KB
1_02.txt AC 3 ms 256 KB
1_03.txt AC 3 ms 256 KB
1_04.txt AC 3 ms 256 KB
1_05.txt AC 3 ms 256 KB
1_06.txt AC 3 ms 256 KB
1_07.txt AC 3 ms 256 KB
1_08.txt AC 3 ms 256 KB
1_09.txt WA 846 ms 2420 KB
1_10.txt WA 857 ms 2420 KB
1_11.txt AC 843 ms 2420 KB
1_12.txt WA 859 ms 2548 KB
1_13.txt WA 853 ms 2420 KB
1_14.txt AC 3 ms 256 KB
1_15.txt AC 3 ms 256 KB
1_16.txt WA 489 ms 1528 KB
1_17.txt WA 835 ms 2292 KB
1_18.txt WA 354 ms 1144 KB
1_19.txt AC 3 ms 256 KB