54132023-05-14 16:51:34kicsiboglarMediánok (40 pont)cpp11Accepted 40/4010ms4804 KiB
#include <iostream>
//#include <fstream>
#include <vector>
using namespace std;
//ifstream cin("input.in");
//ofstream cout ("output.out");
using ll= long long;
//using P= pair<ll,ll>;

ll n,m,i,j,a,b;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);

     cin>>n>>m;
     for (i=1;i<m;++i)
     {
        if(i%2!=0)
        {
            cout<<n-(i/2)<<" ";
        }
        else cout<<i/2<<" ";
     }

    cout<<(n+1)/2<<" ";

    for (i=m+1;i<=n;++i)
    {
        if(i%2==0)
        {
            cout<<n-((i-1)/2)<<" ";
        }
        else cout<<(i-1)/2<<" ";
    }
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms2156 KiB
2Accepted0/09ms2504 KiB
3Accepted1/13ms2488 KiB
4Accepted1/13ms2664 KiB
5Accepted1/13ms2796 KiB
6Accepted1/13ms2880 KiB
7Accepted1/13ms3104 KiB
8Accepted1/12ms3176 KiB
9Accepted1/12ms3080 KiB
10Accepted1/13ms3172 KiB
11Accepted1/13ms3300 KiB
12Accepted1/12ms3284 KiB
13Accepted1/13ms3396 KiB
14Accepted1/13ms3388 KiB
15Accepted1/13ms3520 KiB
16Accepted1/13ms3620 KiB
17Accepted1/13ms3516 KiB
18Accepted1/13ms3644 KiB
19Accepted1/13ms3876 KiB
20Accepted1/13ms3940 KiB
21Accepted1/19ms4240 KiB
22Accepted1/19ms4136 KiB
23Accepted1/19ms4388 KiB
24Accepted1/19ms4348 KiB
25Accepted1/19ms4348 KiB
26Accepted1/19ms4404 KiB
27Accepted1/19ms4396 KiB
28Accepted1/19ms4476 KiB
29Accepted1/19ms4452 KiB
30Accepted1/19ms4412 KiB
31Accepted1/19ms4596 KiB
32Accepted1/19ms4584 KiB
33Accepted1/19ms4588 KiB
34Accepted2/29ms4604 KiB
35Accepted1/19ms4556 KiB
36Accepted1/19ms4472 KiB
37Accepted2/29ms4484 KiB
38Accepted1/19ms4524 KiB
39Accepted1/19ms4520 KiB
40Accepted1/110ms4804 KiB