結果
| 問題 | No.2774 Wake up Record 2 |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-01-22 11:27:38 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 643 bytes |
| 記録 | |
| コンパイル時間 | 3,339 ms |
| コンパイル使用メモリ | 337,652 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-22 11:27:43 |
| 合計ジャッジ時間 | 4,895 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, k;
cin >> n >> k;
vector<int> a(n);
rep(i, n) cin >> a[i];
int l = 1, r = 1e9 + 7;
while (r - l > 1) {
int mid = (l + r) / 2;
int cnt = 0;
rep(i, n) cnt += a[i] <= mid;
(cnt < k ? l : r) = mid;
}
vector<int> ans;
rep(i, n - 1) if (a[i] <= l + 1 && a[i + 1] > l + 1) ans.push_back(i + 1);
cout << ans.size() << '\n';
rep(i, ans.size()) cout << ans[i] + 1 << ' ';
cout << '\n';
return 0;
}
a01sa01to