CF660B.Seating On Bus

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Consider 2n2n rows of the seats in a bus. nn rows of the seats on the left and nn rows of the seats on the right. Each row can be filled by two people. So the total capacity of the bus is 4n4n .

Consider that mm ( m<=4nm<=4n ) people occupy the seats in the bus. The passengers entering the bus are numbered from 11 to mm (in the order of their entering the bus). The pattern of the seat occupation is as below:

11 -st row left window seat, 11 -st row right window seat, 22 -nd row left window seat, 22 -nd row right window seat, ... , nn -th row left window seat, nn -th row right window seat.

After occupying all the window seats (for m>2n ) the non-window seats are occupied:

11 -st row left non-window seat, 11 -st row right non-window seat, ... , nn -th row left non-window seat, nn -th row right non-window seat.

All the passengers go to a single final destination. In the final destination, the passengers get off in the given order.

11 -st row left non-window seat, 11 -st row left window seat, 11 -st row right non-window seat, 11 -st row right window seat, ... , nn -th row left non-window seat, nn -th row left window seat, nn -th row right non-window seat, nn -th row right window seat.

The seating for n=9n=9 and m=36m=36 .You are given the values nn and mm . Output mm numbers from 11 to mm , the order in which the passengers will get off the bus.

输入格式

The only line contains two integers, nn and mm ( 1<=n<=100,1<=m<=4n1<=n<=100,1<=m<=4n ) — the number of pairs of rows and the number of passengers.

输出格式

Print mm distinct integers from 11 to mm — the order in which the passengers will get off the bus.

输入输出样例

  • 输入#1

    2 7
    

    输出#1

    5 1 6 2 7 3 4
    
  • 输入#2

    9 36
    

    输出#2

    19 1 20 2 21 3 22 4 23 5 24 6 25 7 26 8 27 9 28 10 29 11 30 12 31 13 32 14 33 15 34 16 35 17 36 18
    
首页