37692023-03-02 21:31:03TuruTamasMediánok (40 pont)cpp17Wrong answer 30/4010ms5152 KiB
//
// Created by tamas on 3/2/2023.
//
#include "bits/stdc++.h"
#include <cstdio>

using namespace std;

int N, K, i, mid;

int main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> N >> K;
    if (K % 2 == 1) {
        for (i = 0; i <= K/2-1; ++i) {
            cout << N-i << " " << i+1 << " ";
        }
        mid = N/2+N%2;
        cout << mid << "  ";
        for (i = 1; i <= mid-K/2-1; ++i) {
            cout << mid+i << " " << mid-i << " ";
        }
        if (N%2 == 0) {
            cout << N-K/2;
        }
    }
    else {
        for (i = 0; i <= K/2-2; ++i) {
            cout << N-i << " " << i+1 << " ";
        }
        cout << " ";
        cout << N-K/2+1 << " ";
        mid = N/2+N%2;
        cout << mid << " ";
        cout << " ";
        for (i = 1; i <= N-K/2-mid; ++i) {
            cout << mid-i << " " << mid+i << " ";
        }
        if (K%2 == 1) {
            cout << K/2;
        }
    }
    cout << "\n";
}
SubtaskSumTestVerdictTimeMemory
base30/40
1Accepted0/03ms1888 KiB
2Accepted0/09ms2212 KiB
3Accepted1/12ms2308 KiB
4Wrong answer0/13ms2520 KiB
5Wrong answer0/13ms2744 KiB
6Accepted1/13ms2952 KiB
7Accepted1/13ms3172 KiB
8Accepted1/12ms3252 KiB
9Accepted1/12ms3240 KiB
10Accepted1/13ms3464 KiB
11Accepted1/12ms3548 KiB
12Wrong answer0/12ms3548 KiB
13Wrong answer0/13ms3684 KiB
14Wrong answer0/13ms3776 KiB
15Accepted1/13ms3888 KiB
16Accepted1/12ms3876 KiB
17Accepted1/13ms4008 KiB
18Accepted1/13ms4216 KiB
19Accepted1/13ms4308 KiB
20Accepted1/13ms4408 KiB
21Accepted1/110ms4568 KiB
22Accepted1/110ms4476 KiB
23Accepted1/110ms4444 KiB
24Accepted1/110ms4348 KiB
25Wrong answer0/110ms4580 KiB
26Wrong answer0/110ms4552 KiB
27Accepted1/19ms4580 KiB
28Accepted1/110ms4580 KiB
29Accepted1/110ms4652 KiB
30Accepted1/110ms4652 KiB
31Accepted1/110ms4864 KiB
32Accepted1/110ms4948 KiB
33Wrong answer0/110ms4864 KiB
34Accepted2/210ms4872 KiB
35Wrong answer0/110ms5100 KiB
36Accepted1/110ms5152 KiB
37Accepted2/210ms5072 KiB
38Accepted1/110ms5072 KiB
39Wrong answer0/110ms5088 KiB
40Accepted1/110ms5076 KiB