-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP173PROE.cpp
More file actions
48 lines (41 loc) · 847 Bytes
/
P173PROE.cpp
File metadata and controls
48 lines (41 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
using namespace std;
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Ford(i, a, b) for(int i = a; i >= b; i--)
#define ll long long
#define here cout<<"I am Here"<<endl;
int const maxn = 1000000;
int const base = 1e9 + 7;
int a[maxn], b[maxn], c[maxn];
bool cmp(int a, int b){
return a > b;
}
int main(void){
int N, K;
int j = 1;
cin>>N>>K;
For(i, 1, N){
cin>>a[i];
b[j] = a[i];
j++;
}
sort(b + 1, b + N + 1, cmp);
cout<<b[K]<<endl;
int res = 0;
For(i, 1, N){
if(a[i] > b[K]){
res++;
c[res] = i;
}
}
For(i, 1, N){
if(a[i] == b[K]){
res++;
c[res] = i;
if(res == K) break;
}
}
sort(c + 1, c + res + 1);
For(i, 1, res) cout<<c[i]<<" ";
return 0;
}