結果

問題 No.2210 equence Squence Seuence
ユーザー roarisroaris
提出日時 2023-02-18 04:32:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 861 bytes
コンパイル時間 2,243 ms
コンパイル使用メモリ 200,576 KB
実行使用メモリ 4,896 KB
最終ジャッジ日時 2023-09-27 00:42:33
合計ジャッジ時間 6,932 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 AC 10 ms
4,380 KB
testcase_05 AC 14 ms
4,384 KB
testcase_06 AC 12 ms
4,380 KB
testcase_07 AC 32 ms
4,664 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,384 KB
testcase_13 AC 39 ms
4,784 KB
testcase_14 AC 39 ms
4,896 KB
testcase_15 AC 39 ms
4,788 KB
testcase_16 AC 39 ms
4,880 KB
testcase_17 AC 39 ms
4,804 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,500 KB
testcase_23 AC 28 ms
4,668 KB
testcase_24 AC 21 ms
4,380 KB
testcase_25 AC 26 ms
4,744 KB
testcase_26 AC 34 ms
4,760 KB
testcase_27 AC 10 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back
typedef long long ll;

int N, K;
int A[200010];

int rec(int l, int r, int k, int i) {
    // cout << l << " " << r << " " << k << " " << i << endl;
    if (i==N-1) return l;
    if (A[i+1]<A[i]) {
        if (k<=i-l+1) return rec(l, i, k, i+1);
        else return rec(i+1, r, k-(i-l+1), i+1);
    } else if (A[i+1]>A[i]) {
        if (k>r-i) return rec(l, i, k-(r-i), i+1);
        else return rec(i+1, r, k, i+1);
    } else return rec(l, r, k, i+1);
}

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    
    cin >> N >> K;
    rep(i, N) cin >> A[i];
    int x = rec(0, N-1, K, 0);
    vector<int> B;
    rep(i, N) if (i!=x) B.pb(A[i]);
    rep(i, N-1) {
        if (i<N-1) cout << B[i] << " ";
        else cout << B[i] << endl;
    }
}
0