日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Diverse Team(CF-988A)

發布時間:2025/3/17 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Diverse Team(CF-988A) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Problem Description

There are nn students in a school class, the rating of the i-th student on Codehorses is aiai. You have to form a team consisting of kk students (1≤k≤n) such that the ratings of all team members are distinct.

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print kk distinct numbers which should be the indices of students in the team you form. If there are multiple answers, print any of them.

Input

The first line contains two integers n and k (1≤k≤n≤100) — the number of students and the size of the team you have to form.

The second line contains n integers a1,a2,…,an (1≤ai≤100), where aiai is the rating of i-th student.

Output

If it is impossible to form a suitable team, print "NO" (without quotes). Otherwise print "YES", and then print k distinct integers from 1 to n which should be the indices of students in the team you form. All the ratings of the students in the team should be distinct. You may print the indices in any order. If there are multiple answers, print any of them.

Assume that the students are numbered from 1 to n.

Examples

Input

5 3
15 13 15 15 12

Output

YES
1 2 5?

Input

5 4
15 13 15 15 12

Output

NO

Input

4 4
20 10 40 30

Output

YES
1 2 3 4?

題意:給出 n 個學生的成績,要在 n 個學生里選 k 個人組成一隊,要求 k 個人的成績均不相同,如果可以,輸出 YES 以及選的人的編號,如果不行,輸出 NO

思路:設置一標記數組,記錄分數不同的人的編號以及個數,如果小于 k,則輸出 NO,如果滿足條件,依次輸出即可。

Source Program

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<string> #include<cstdlib> #include<queue> #include<set> #include<map> #include<stack> #include<ctime> #include<vector> #define INF 0x3f3f3f3f #define PI acos(-1.0) #define N 10005 #define MOD 123 #define E 1e-6 using namespace std; int a[N]; int vis[N]; int ans[N]; int main() {int n,k;cin>>n>>k;int cnt=0;for(int i=1;i<=n;i++){cin>>a[i];if(!vis[a[i]])//如果分數未出現過{cnt++;//不同的分數+1ans[cnt]=i;//記錄位置}vis[a[i]]=1;//標記}if(cnt<k)//不同分數小于要求數cout<<"NO"<<endl;else{cout<<"YES"<<endl;for(int i=1;i<=k;i++)cout<<ans[i]<<" ";cout<<endl;}return 0; }

?

總結

以上是生活随笔為你收集整理的Diverse Team(CF-988A)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。