hihoCoder Challenge 32 register

Ended

Participants:282

Verdict:Accepted
Submitted:2017-12-03 19:06:34

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100010],b[100010];
int main()
{
    int n;
    cin>>n;
    int ta=0,tb=0;
    for (int i=1;i<=n;i++)
    {
        int x=i;
        if (x%2) a[++ta]=x;
        else b[++tb]=x;
    }
    sort(a+1,a+1+ta);
    sort(b+1,b+1+tb);
    cout<<1;
    for (int i=2;i<=ta;i++)
        cout<<' '<<a[i];
    for (int i=tb;i>=1;i--)
        cout<<' '<<b[i];
    cout<<endl;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX