46412023-03-30 13:55:01Error42Mediánok (40 pont)cpp17Accepted 40/4010ms4900 KiB
#include <iostream>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;

    for (int i = 0; i < k - 1; i++) {
        if (i % 2 == 0)
            cout << n - i / 2 << " ";
        else
            cout << (i + 1) / 2 << " ";
    }

    int median = (n + 1) / 2;

    cout << median << " ";

    for (int i = k; i < n; i++) {
        int j = i - 1;

        if (j % 2 == 0)
            cout << n - j / 2 << " ";
        else
            cout << (j + 1) / 2 << " ";
    }

    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1960 KiB
2Accepted0/09ms2324 KiB
3Accepted1/13ms2400 KiB
4Accepted1/13ms2592 KiB
5Accepted1/13ms2752 KiB
6Accepted1/13ms2844 KiB
7Accepted1/13ms2840 KiB
8Accepted1/13ms2968 KiB
9Accepted1/13ms3216 KiB
10Accepted1/13ms3176 KiB
11Accepted1/13ms3264 KiB
12Accepted1/13ms3264 KiB
13Accepted1/13ms3368 KiB
14Accepted1/13ms3500 KiB
15Accepted1/13ms3472 KiB
16Accepted1/13ms3612 KiB
17Accepted1/13ms3696 KiB
18Accepted1/13ms3908 KiB
19Accepted1/13ms4040 KiB
20Accepted1/13ms4192 KiB
21Accepted1/19ms4312 KiB
22Accepted1/19ms4312 KiB
23Accepted1/19ms4312 KiB
24Accepted1/110ms4516 KiB
25Accepted1/19ms4600 KiB
26Accepted1/19ms4644 KiB
27Accepted1/19ms4720 KiB
28Accepted1/19ms4716 KiB
29Accepted1/19ms4660 KiB
30Accepted1/19ms4656 KiB
31Accepted1/110ms4648 KiB
32Accepted1/19ms4660 KiB
33Accepted1/19ms4656 KiB
34Accepted2/210ms4876 KiB
35Accepted1/19ms4872 KiB
36Accepted1/19ms4860 KiB
37Accepted2/29ms4876 KiB
38Accepted1/19ms4884 KiB
39Accepted1/19ms4872 KiB
40Accepted1/110ms4900 KiB