A. Almost Equal

A. Almost Equal

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given integer nn. You have to arrange numbers from 11 to 2n2n, using each of them exactly once, on the circle, so that the following condition would be satisfied:

For every nn consecutive numbers on the circle write their sum on the blackboard. Then any two of written on the blackboard 2n2n numbers differ not more than by 11.

For example, choose n=3n=3. On the left you can see an example of a valid arrangement: 1+4+5=101+4+5=10, 4+5+2=114+5+2=11, 5+2+3=105+2+3=10, 2+3+6=112+3+6=11, 3+6+1=103+6+1=10, 6+1+4=116+1+4=11, any two numbers differ by at most 11. On the right you can see an invalid arrangement: for example, 5+1+6=125+1+6=12, and 3+2+4=93+2+4=9, 99 and 1212 differ more than by 11.

Input

The first and the only line contain one integer nn (1≤n≤1051≤n≤105).

Output

If there is no solution, output "NO" in the first line.

If there is a solution, output "YES" in the first line. In the second line output 2n2n numbers — numbers from 11 to 2n2n in the order they will stay in the circle. Each number should appear only once. If there are several solutions, you can output any of them.

Examples

input

Copy

3

output

Copy

YES
1 4 5 2 3 6 

input

Copy

4

output

Copy

NO

Note

Example from the statement is shown for the first example.

It can be proved that there is no solution in the second example.

=========================================================================

这种规律题目一定是线性推的,也就是从答案1一直推到答案2n。不难发现,1正对着2,3正对着4,5正对着6,并且发现这在坐标上就是+n的位置差别。

且是1 2 4 3 5 6

一大一小排列

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

int ans[100000*2+10];

int main()
{

    int n;

    cin>>n;

    if(n%2)
    {
        cout<<"YES"<<endl;

        int now=1;

        for(int i=1;i<=n;i++)
        {
            if(i%2)
            {
                ans[i]=now;
                ans[i+n]=now+1;

                now+=2;
            }
            else
            {
                ans[i]=now+1;
                ans[i+n]=now;
                now+=2;
            }
        }

        for(int i=1;i<=2*n;i++)
        {
            cout<<ans[i]<<" ";
        }


    }
    else
    {
        cout<<"NO"<<endl;
    }


    return 0;
}

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

秦三码

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值