题目链接
There are n students in a school class, the rating of the i-th student on Codehorses is ai. You have to form a team consisting of k 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 k 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 ai 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.

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

Note
All possible answers for the first example:

{1 2 5}
{2 3 5}
{2 4 5}
Note that the order does not matter.

#include<bits/stdc++.h>
using namespace std;
int main(){int n,m,t,k;map <int,int> mp;scanf("%d%d",&n,&m);for(int i = 1;i <= n;i++){scanf("%d",&t);mp[t] = i;}if(mp.size() < m) puts("NO");else{k = 0,puts("YES");for(auto i = mp.begin();i != mp.end();i++){if(k) puts(" ");printf("%d",i->second);if(++k == m) break;}}return 0;
}

A. Diverse Team相关推荐

  1. Diverse Team(CF-988A)

    Problem Description There are nn students in a school class, the rating of the i-th student on Codeh ...

  2. 辍学的名人_我辍学去追求成为网络开发人员和设计师的梦想

    辍学的名人 by Carlos Sz 由Carlos Sz 我辍学去追求成为网络开发人员和设计师的梦想 (I dropped out of college to pursue my dreams of ...

  3. Codeforces Round #486 (Div. 3)【完结】

    2022.3.2 题单地址:https://codeforces.com/contest/988 目录 A. Diverse Team[模拟] B. Substrings Sort[暴力枚举] C. ...

  4. 加油python_力扣——gas station (加油站) python实现

    题目描述: 中文: 在一条环路上有 N 个加油站,其中第 i 个加油站有汽油 gas[i] 升. 你有一辆油箱容量无限的的汽车,从第 i 个加油站开往第 i+1 个加油站需要消耗汽油 cost[i] ...

  5. 如何进入游戏行业_进入设计行业

    如何进入游戏行业 We're living in some weird-ass times. One of the unfortunate results of a global pandemic i ...

  6. 管道过滤模式 大数据_大数据管道配方

    管道过滤模式 大数据 介绍 (Introduction) If you are starting with Big Data it is common to feel overwhelmed by t ...

  7. 基础算法 —— 模拟思维

    [概述] 模拟,是根据实际问题建立模型,模拟实际按程序走一遍,最终求出答案. 思维,则是与逻辑思维有关,其需要针对题意.数据范围等抽丝剥茧抽离出有用的信息,从而得出一个结果. 对于一般的模拟,直接根据 ...

  8. 遇见OFFER,阿里云最强技术团队现身招聘,“职”为你来

    简历投递入口: https://bss.csdn.net/delivery/resume/ali 在5·15 遇见OFFER大厂梦招聘活动中,近20家企业来到CSDN[遇见OFFER]直播招聘栏目,其 ...

  9. 2020阿里招聘岗位要求

    简历投递入口: https://bss.csdn.net/delivery/resume/ali 职位名称 职位描述 职位要求 阿里云智能事业群-中间件业务中台架构师-北京\杭州 1.负责阿里云中台项 ...

  10. 性别歧义代词(GAP) 2019年 NLP 研讨会性别偏见问题共同任务--阅读笔记

    Gendered Ambiguous Pronouns (GAP) Shared Task at the Gender Bias in NLP Workshop 2019 https://www.ac ...

最新文章

  1. 一分钟了解 TCP/IP 模型
  2. EventBus VS Spring Event
  3. 暮色森林模组_我的世界怎样进入暮色森林
  4. 爬取广州所有停车场数据(Python)
  5. 轨道半径对氦原子基态能级的影响He
  6. PAT甲级1001 A+B Format:[C++题解]字符串处理
  7. 斗地主AI算法——第十二章の主动出牌(1)
  8. 开源开发工具_3个开源行为驱动的开发工具
  9. Mybatis 图解
  10. 为SAP列表设置新的打印格式
  11. 【深入浅出精华版视频】-刘意day01-10思维导图整理
  12. 网络安全技术心得体会
  13. HDFView打开.h5文件时报错Failed to open file
  14. 实现局部滚动的两种方法:1.三行css代码2.使用BScroll框架
  15. Intelij的IDEA启动报错!parent directory is read-only or the user lacks necessary permissions
  16. Excel求和公式的几种用法
  17. Linux内核中内存分配函数
  18. html病毒DropFileName,王国平博客-HTML 感染 DropFileName = “svchost.exe” Ramnit 蠕虫病毒 查杀解决办法...
  19. Linux修改网络支持巨型帧,linux – KVM来宾和主机之间的巨型帧?
  20. 广州大学城热水解锁卡dump

热门文章

  1. SDUT-3337 计算长方体、四棱锥的表面积和体积(JAVA*)
  2. TopCoder SRM 682 Div2 1000 FriendlyRobot
  3. 天津天狮学院电子与计算机学院,天津天狮学院欢迎您!
  4. If you are using WebLogic you will need to add ‘org.slf4j‘ to prefer-application-packages in
  5. c盘减肥//请在阅读本文之前查看你C盘的可用空间
  6. WebStorm2016.1.1免注册破解方法
  7. 10套精美而实用的CSS3按钮
  8. 如何给服务器IIS配置文件夹配置everyone权限
  9. EBS功能_如何月结对账
  10. [Go]基于Go语言的Web路由转发,多个网站共享一个端口(新版本,支持WebSocket)