Submission #1352938


Source Code Expand

#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

int f(vector<int> v){
	int size = v.size();
	vector<int> now = v;
	while( size > 1 ){
		vector<int> next;
		vector<int> temp(3);
		for(int i=0;i<size-2;++i){
			temp[0] = now[i];
			temp[1] = now[i+1];
			temp[2] = now[i+2];
			sort(temp.begin(), temp.end());
			next.push_back( temp[1] );
		}
		now = next;
		size = now.size();
	}
	return now[0];
}
void solve(){
	int N,X;
	cin >> N >> X;
	vector<int> A(2*N-1,-1);
	int size = A.size();

	if( X==1 || X==(2*N-1) ){
		cout << "No" << endl;
		return;
	}
	if( N==2 ){
		for(int i=1;i<4;++i){
			cout << i << endl;
		}
		return;
	}
	if( X==2 ){//大 X 小 大
		A[N-2] = 3;
		A[N-1] = X;//2
		A[N] = 1;
		A[N+1] = 4;
		int num = 5;
		for(int i=0;i<size;++i){
			if( A[i] == -1 ){
				A[i] = num;
				++num;
				cout << A[i] << '\n';
			}else{
				cout << A[i] << '\n';
			}
		}
		cout << flush;
cerr << f(A) << endl;
		return;
	}else{//小 X 大 小
		A[N-2] = X-2;
		A[N-1] = X;
		A[N] = X+1;
		A[N+1] = X-1;
		int num = 1;
		for(int i=0;i<size;++i){
			if( X-2 <= num && num <= X+1 ){
				num = X+2;
			}
			if( A[i] == -1 ){
				A[i] = num;
				++num;
				cout << A[i] << '\n';
			}else{
				cout << A[i] << '\n';
			}
		}
		cout << flush;
cerr << f(A) << endl;
		return;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()

Submission Info

Submission Time
Task B - Median Pyramid Easy
User akarin55
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2481 Byte
Status WA
Exec Time 2104 ms
Memory 5748 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 1
WA × 1
AC × 9
WA × 5
TLE × 8
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 WA 1 ms 256 KB
0_01.txt AC 1 ms 256 KB
1_00.txt AC 1 ms 256 KB
1_01.txt WA 1 ms 256 KB
1_02.txt AC 1 ms 256 KB
1_03.txt AC 1 ms 256 KB
1_04.txt WA 1 ms 256 KB
1_05.txt WA 1 ms 256 KB
1_06.txt WA 1 ms 256 KB
1_07.txt AC 1 ms 256 KB
1_08.txt AC 2 ms 1024 KB
1_09.txt TLE 2104 ms 5744 KB
1_10.txt TLE 2103 ms 5744 KB
1_11.txt TLE 2103 ms 5748 KB
1_12.txt TLE 2103 ms 5748 KB
1_13.txt TLE 2103 ms 5748 KB
1_14.txt AC 2 ms 1024 KB
1_15.txt AC 1 ms 384 KB
1_16.txt TLE 2103 ms 3352 KB
1_17.txt TLE 2103 ms 5616 KB
1_18.txt TLE 2103 ms 2612 KB
1_19.txt AC 1 ms 512 KB