結果

問題 No.2774 Wake up Record 2
ユーザー tobbietobbie
提出日時 2024-07-17 21:47:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 173,416 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-17 21:47:42
合計ジャッジ時間 3,136 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, j, n) for (int i = (int)j; i < (int)n; i++)

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  rep(i, 0, n)
    cin >> a[i];
  vector<int> b = a;
  sort(b.begin(), b.end());
  int det = b[k - 1];
  vector<int> ans;
  rep(i, 1, n) {
    if (a[i-1] <= det && a[i] > det)
      ans.push_back(i+1);
  }
  cout << (int)ans.size() << endl;
  for (int n : ans)
    cout << n << " ";
  cout << endl;
  return 0;
}
0