提出 #69539496


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;

void solve() {
    cin>>n>>k;

    if (k >= 2) {
        for (int i=k; i>=1; --i) cout<<i<<" ";
        for (int i=k+1; i<=n; ++i) cout<<i<<" ";
        cout<<"\n";
    } else if (k == 1) {
        if (n == 1) cout<<1<<"\n";
        else if (n >= 5) {
            cout<<"2 5 3 1 4 ";
            for (int i=6; i<=n; ++i) cout<<i<<" ";
            cout<<"\n";
        } else cout<<-1<<"\n";
    } else if (k == 0) {
        if (n >= 8) {
            cout<<"6 5 1 2 7 8 4 3 ";
            for (int i=9; i<=n; ++i) cout<<i<<" ";
            cout<<"\n";
        } else cout<<-1<<"\n";
    }
}

int main() {
    int t=1; cin>>t;
    while (t--) solve();
}

提出情報

提出日時
問題 D - LIS ∩ LDS
ユーザ Dec0Dedd
言語 C++ 20 (gcc 12.2)
得点 700
コード長 768 Byte
結果 AC
実行時間 241 ms
メモリ 3676 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 700 / 700
結果
AC × 1
AC × 24
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_max_00.txt, 02_max_01.txt, 02_max_02.txt, 02_max_03.txt, 02_max_04.txt, 02_max_05.txt, 03_small_00.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3492 KiB
01_random_00.txt AC 13 ms 3456 KiB
01_random_01.txt AC 13 ms 3484 KiB
01_random_02.txt AC 13 ms 3484 KiB
01_random_03.txt AC 13 ms 3472 KiB
01_random_04.txt AC 13 ms 3536 KiB
01_random_05.txt AC 13 ms 3676 KiB
01_random_06.txt AC 13 ms 3484 KiB
01_random_07.txt AC 13 ms 3604 KiB
01_random_08.txt AC 13 ms 3476 KiB
01_random_09.txt AC 13 ms 3532 KiB
01_random_10.txt AC 13 ms 3524 KiB
01_random_11.txt AC 13 ms 3668 KiB
01_random_12.txt AC 13 ms 3408 KiB
01_random_13.txt AC 13 ms 3496 KiB
01_random_14.txt AC 13 ms 3676 KiB
01_random_15.txt AC 16 ms 3540 KiB
02_max_00.txt AC 13 ms 3412 KiB
02_max_01.txt AC 13 ms 3676 KiB
02_max_02.txt AC 13 ms 3548 KiB
02_max_03.txt AC 13 ms 3372 KiB
02_max_04.txt AC 13 ms 3420 KiB
02_max_05.txt AC 241 ms 3524 KiB
03_small_00.txt AC 16 ms 3488 KiB