当前位置:网站首页>PTA: 点赞狂魔
PTA: 点赞狂魔
2022-04-23 02:05:00 【JackDawn!?】
题目
输入样例:
5
bob 11 101 102 103 104 105 106 107 108 108 107 107
peter 8 1 2 3 4 3 2 5 1
chris 12 1 2 3 4 5 6 7 8 9 1 2 3
john 10 8 7 6 5 4 3 2 1 7 5
jack 9 6 7 8 9 10 11 12 13 14
输出样例:
jack chris john
代码
#include <cstdio>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <cstring>
#include <algorithm>
using namespace std;
map<string, set<int> > mp;
struct P{
char name[10];
int size = 0;
int cnt = 0;
};
bool cmp(const P& l, const P& r) {
int sl = l.size, sr = r.size;
if(sl != sr) {
return sl > sr;
}
return l.cnt < r.cnt;
}
int main(void)
{
freopen("in.txt", "r", stdin);
vector<P> vec;
int N, label; char str[10];
vec.reserve(105);
scanf("%d", &N);
set<int> s;
int x;
for(int i = 0; i < N; ++i) {
s.clear();
scanf("%s", str);
strcpy(vec[i].name, str);
scanf("%d", &x);
while(x--) {
scanf("%d", &label);
s.insert(label);
++vec[i].cnt;
}
vec[i].size = s.size();
}
sort(vec.begin(), vec.begin()+N+1, cmp);
bool flag = true;
int t = min(N, 3);
for(int i = 0; i < 3; ++i) {
if(flag) flag = false;
else printf(" ");
if(i >= t) printf("-");
else printf("%s", vec[i].name);
}
return 0;
}
版权声明
本文为[JackDawn!?]所创,转载请带上原文链接,感谢
https://blog.csdn.net/apple_52296856/article/details/124315732
边栏推荐
- Sqlserver data transfer to MySQL
- Makefile文件是什么?
- J-Link RTT使用
- FL studio20. 8 the latest Chinese version installation and download graphic tutorial
- Today will finally write system out. Println()
- [Dahua cloud native] micro service chapter - service mode of five-star hotels
- Numerical remapping method (remap)
- 我国科学家揭示突破水稻产量瓶颈新机制
- How to change the size of SVG pictures without width in openlayer
- 揭秘被Arm编译器所隐藏的浮点运算
猜你喜欢

postman里面使用 xdebug 断点调试

A simple and open source navigation website source code

MySQL basic record

Communication summary between MCU and 4G module (EC20)

动态代理ip的测试步骤有哪些?

006_redis_SortedSet类型
![[assembly language] understand](/img/73/2483bca93714e378ff5eef18bddcd1.jpg)
[assembly language] understand "stack" from the lowest point of view

浅析静态代理ip的三大作用。

Some tips for using proxy IP.

009_Redis_RedisTemplate入门
随机推荐
How to change the size of SVG pictures without width in openlayer
Basic knowledge of software testing, you can meet the interviewer after reading it
The leader / teacher asks to fill in the EXCEL form document. How to edit the word / Excel file on the mobile phone and fill in the Excel / word electronic document?
拨号vps会遇到什么问题?
BGP服务器在什么业务场景会被用到?
有哪些常见的代理ip问题?
What is BGP server and what are its advantages?
hyperscan --- 1
Sqlserver data transfer to MySQL
How to configure iptables to realize local port forwarding
[hands on learning] network depth v2.1 Sequence model
Shardingsphere read write separation
2022.4.10-----leetcode. eight hundred and four
Shardingsphere sub database and sub table
What business scenarios will the BGP server be used in?
Dynamic batch processing and static batch processing of unity
在使用代理IP前需要了解哪些分类?
Use of push() and pop()
001_redis设置存活时间
如何设置电脑ip?