結果
| 問題 |
No.2774 Wake up Record 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-07 21:33:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 49 ms / 2,000 ms |
| コード長 | 1,665 bytes |
| コンパイル時間 | 1,589 ms |
| コンパイル使用メモリ | 122,240 KB |
| 実行使用メモリ | 5,504 KB |
| 最終ジャッジ日時 | 2024-12-26 07:12:02 |
| 合計ジャッジ時間 | 2,460 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string str;
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define MAX_LL (1LL<<62)
#define MOD 998244353
ll max(const ll &a, const ll &b) {if(a>b) return a; else return b;}
ll min(const ll &a, const ll &b) {if(a<b) return a; else return b;}
ll calc_gcd(ll a, ll b) {while(true){if(a*b == 0) return a+b; else if(a>b) a %= b; else b %= a;}}
ull pow_mod(ull a, ull b, ull mod=-1) {if(mod<2) return 0; ull ans=1, now=a; while(b>0){if(b%2) ans=(ans*now)%mod; now=(now*now)%mod; b/=2;} return ans;}
bool update_max(ll &a, const ll &b) {if(a<b){a=b; return true;} else return false;}
bool update_max(ld &a, const ld &b) {if(a<b){a=b; return true;} else return false;}
bool update_min(ll &a, const ll &b) {if(a>b){a=b; return true;} else return false;}
bool update_min(ld &a, const ld &b) {if(a>b){a=b; return true;} else return false;}
int main() {
ll N, K;
cin >> N >> K;
vector<ll> A(N);
for(ll i=0; i<N; i++){
cin >> A[i];
}
vector<ll> sortedA = A;
sort(ALL(sortedA));
ll sleep = sortedA[K-1];
vector<bool> is_sleepings(N);
for(ll i=0; i<N; i++){
is_sleepings[i] = A[i] <= sleep;
}
vector<ll> answers;
for(ll i=1; i<N; i++){
if(!is_sleepings[i] && is_sleepings[i-1])
answers.push_back(i+1);
}
cout << answers.size() << endl;
for(ll i=0; i<answers.size(); i++){
cout << answers[i];
if(i != answers.size() - 1){
cout << " ";
}
}
cout << endl;
return 0;
}