結果

問題 No.2210 equence Squence Seuence
ユーザー shirokamishirokami
提出日時 2023-02-10 22:40:22
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,008 bytes
コンパイル時間 3,450 ms
コンパイル使用メモリ 248,084 KB
実行使用メモリ 6,216 KB
最終ジャッジ日時 2023-09-21 23:50:11
合計ジャッジ時間 5,638 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 12 ms
4,380 KB
testcase_07 AC 30 ms
5,616 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 37 ms
6,216 KB
testcase_14 AC 37 ms
6,160 KB
testcase_15 AC 38 ms
6,204 KB
testcase_16 AC 38 ms
6,152 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 28 ms
5,732 KB
testcase_24 AC 21 ms
4,840 KB
testcase_25 AC 24 ms
5,404 KB
testcase_26 AC 32 ms
6,208 KB
testcase_27 AC 10 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include <boost/math/tools/minima.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// #include <atcoder/all>
// using namespace atcoder;
// https://atcoder.github.io/ac-library/production/document_ja/
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 922337203685477580;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using V = vector<ll>;
using P = pair<ll,ll>;
vector<ll> dx = {1, 0, -1, 0, 1, 1, -1, -1};
vector<ll> dy = {0, 1, 0, -1, 1, -1, 1, -1};
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
struct edge{ll to, cost;};
using graph = vector<vector<edge> >;
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << setprecision(15) << fixed;
  }
} iosetup;
void printvec(vector<ll> a) {
  for(ll i = 0; i < a.size(); i++) {
    cout << a[i] << ' ';
  }
  cout << '\n';
}
void printgrid(vector<vector<ll>> g) {
  for (ll i = 0; i < g.size(); i++) {
    printvec(g[i]);
  }
}

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];
  vector<ll> b(n);
  ll l = 1, r = n;
  ll cnt = 1;
  rep(i,n-1) {
    if (a[i] > a[i+1]) {
      rep(j, cnt) {
        b[i+j] = l;
        l++;
        cnt = 1;
      }
    }
    else if (a[i] < a[i+1]) {
      rep(j, cnt) {
        b[i+j] = r;
        r--;
        cnt = 1;
      }
    }
    else {
      cnt++;
    }
  }
  rep(j, cnt-1) {
    b[n-cnt+j] = l;
    l++;
  }
  b[n-1] = l;
  rep(i,n) {
    if (b[i] != k) {
      cout << a[i] << ' ';
    }
  }
  cout << '\n';
}
0