結果

問題 No.2210 equence Squence Seuence
ユーザー keisuke6keisuke6
提出日時 2023-02-10 21:31:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 75 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 2,035 ms
コンパイル使用メモリ 204,312 KB
実行使用メモリ 6,468 KB
最終ジャッジ日時 2023-09-21 22:34:56
合計ジャッジ時間 4,844 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 16 ms
4,376 KB
testcase_04 AC 18 ms
4,376 KB
testcase_05 AC 27 ms
4,376 KB
testcase_06 AC 24 ms
4,376 KB
testcase_07 AC 60 ms
5,596 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 75 ms
6,136 KB
testcase_14 AC 75 ms
6,304 KB
testcase_15 AC 75 ms
6,276 KB
testcase_16 AC 75 ms
6,468 KB
testcase_17 AC 74 ms
6,304 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 57 ms
5,692 KB
testcase_24 AC 43 ms
4,924 KB
testcase_25 AC 51 ms
5,364 KB
testcase_26 AC 68 ms
6,288 KB
testcase_27 AC 19 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,K;
  cin>>N>>K;
  bool p = true;
  deque<int> q;
  vector<int> S(N);
  for(int i=0;i<N;i++) cin>>S[i];
  q.push_back(N-1);
  for(int i=N-2;i>=0;i--){
      if(S[i] < S[i+1] || (S[i] == S[i+1] && p)){
          q.push_back(i);
          p = true;
      } 
      else{
          q.push_front(i);
          p = false;
      } 
  }
  for(int i=0;i<K-1;i++) q.pop_front();
  for(int i=0;i<N;i++)if(i != q.front()) cout<<S[i]<<' ';
  cout<<endl;
}
0