A Qualifiers Ranking Rules---The 2023 ICPC Asia Regionals Online Contest (1)

这篇具有很好参考价值的文章主要介绍了A Qualifiers Ranking Rules---The 2023 ICPC Asia Regionals Online Contest (1)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

The following is the current ranking rules for the ICPC Asia EC Online Qualifiers, and there will be two online contests.

  1. In each contest, only the rank of the top-ranked team from each university will be taken as the score of that university;
  2. In each contest, participating universities will be ranked according to their scores;
  3. The two rankings of universities are combined using the merge sorting method. For any two universities that obtain the same ranking in different contests, the university that received this ranking in the first contest will be ranked first.
  4. Delete duplicate universities and obtain the final ranking of all participating universities (only the highest rankings for each university are retained).

Now assuming that there are n teams in the first contest and m teams in the second contest.

For each contest, given the ranking of each team and the university to which it belongs, please output the final ranking of all participating universities according to the above rules.

You can better understand this process through the sample.

Input

The first line contains two integers n,m (1≤n,m≤1e4) , representing the number of teams participating in the first contest and the second contest.

Then following n lines, the i-th line contains a string si​ (1≤∣si​∣≤10) only consisting of uppercase letters, representing the abbreviation of the university to which the i-th ranked team in the first contest belongs.

Then following m lines, the i-th line contains a string ti​ (1≤∣ti​∣≤10) only consisting of uppercase letters, representing the abbreviation of the university to which the i-th ranked team in the second contest belongs.

It’s guaranteed that each university has only one abbreviation.

Output

Output several lines, the i-th line contains a string, representing the abbreviation of the i-th ranked university in the final ranking.

You should ensure that the abbreviation of any participating universities appears exactly once.

Input Sample

14 10
THU
THU
THU
THU
XDU
THU
ZJU
THU
ZJU
THU
NJU
WHU
THU
HEU
PKU
THU
PKU
PKU
ZJU
NUPT
THU
NJU
CSU
ZJU

Output Sample

THU
PKU
XDU
ZJU
NJU
NUPT
WHU
HEU
CSU

Hint

Sample is part of the results in 2022 ICPC Asia EC Online Contest.

In the first contest, the ranking of the universities is:

THU
XDU
ZJU
NJU
WHU
HEU

In the second contest, the ranking of the universities is:

PKU
THU
ZJU
NUPT
NJU
CSU

By combining these two rankings according to the rules, the rankings of the universities is:

THU
PKU
XDU
THU
ZJU
ZJU
NJU
NUPT
WHU
NJU
HEU
CSU

By deleting duplicate universities we will get the final ranking.

解析:

        首先对于两个榜单,统计并且去重。

        然后对于榜单a和b进行遍历,并且记录是否重复。

        注意,有的学校可能没参加某一场,所以可能导致两场榜单去重之后长度不一样。文章来源地址https://www.toymoban.com/news/detail-714089.html

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int n,m;
string s;
vector<string>a,b,res;
set<string>p;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		cin>>s;
		if(p.count(s)==0){
			p.insert(s);
			a.push_back(s);
		}
	}
	p.clear();
	for(int i=1;i<=m;i++){
		cin>>s;
		if(p.count(s)==0){
			p.insert(s);
			b.push_back(s);
		}
	}
	p.clear();
	for(int i=0;i<min(a.size(),b.size());i++){
		if(a[i]==b[i]){
			p.insert(a[i]);
			cout<<a[i]<<endl;
		}
		else{
			if(p.count(a[i])==0){
				cout<<a[i]<<endl;
				p.insert(a[i]);
			}
			if(p.count(b[i])==0){
				cout<<b[i]<<endl;
				p.insert(b[i]);
			}
		}
	}
	for(int i=min(a.size(),b.size());i<max(a.size(),b.size());i++){
		if(a.size()>b.size()){
			if(p.count(a[i])==0){
				p.insert(a[i]);
				cout<<a[i]<<endl;
			}
		}
		else{
			if(p.count(b[i])==0){
				p.insert(b[i]);
				cout<<b[i]<<endl;
			}
		}
	}
	return 0;
}

到了这里,关于A Qualifiers Ranking Rules---The 2023 ICPC Asia Regionals Online Contest (1)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Visual studio community 2013,this licence has expired, The online service is not available

    按道理Visual studio community个人版是可以免费使用的,但是需在30天内登陆帐号,才能正常使用。大家忘了申请帐号,就会面临license过期的提示,按提示登陆时,甚至出现“the online servie is not avaiable. Please try again later\\\"。 如下图所示:   相应的解决办法如下: 论坛原文如下:

    2024年02月13日
    浏览(42)
  • 《The Element of Style》阅读笔记 —— 章节 I Elementary Rules of Usage

    前言 :本科期间担任科研助理时,有幸从导师那里借来这本书通读,只记得自己当时在本子上做了一些笔记,但是想不起来具体记了什么😂前段时间再次从学院的讲座活动中听闻这本书,决定重温一遍,本篇为此书第一章的阅读笔记。 本书电子版链接:http://www.jlakes.org/ch

    2024年02月05日
    浏览(32)
  • 用 TripletLoss 优化bert ranking

    下面是 用 TripletLoss 优化bert ranking 的demo

    2024年02月09日
    浏览(20)
  • bert ranking pairwise demo

    下面是用bert 训练pairwise rank 的 demo

    2024年02月09日
    浏览(22)
  • bert ranking listwise demo

    下面是用bert 训练listwise rank 的 demo 

    2024年02月09日
    浏览(35)
  • 超百万人用它生成3D头像,这项技术刚刚中选了SIGGRAPH Asia 2022

    如何才能做一个和真人一样的 3D 头像? 先上传一张照片:   变成这样:   换一个人的照片:     再看一个例子:   眼镜也可以放进来:       在此基础上,还可以换上各种各样的发型、饰品,眼睛、帽子、发色、胡须,皆可编辑。         这效果,是不是可以做一套自

    2023年04月09日
    浏览(39)
  • 2023 年 The Sandbox 生态系统将迎来什么?

    2022 年对于 The Sandbox 来说是多么美好的一年!不仅是对我们的团队来说,对所有与我们建立业务的合作伙伴、才华横溢的创作者、工作室和代理机构来说也是这样。感谢大家让今年最喜欢的时刻成为现实,并成为这个社区的一部分。我们正在共同构建一个去中心化的虚拟世界

    2024年02月06日
    浏览(28)
  • 2020ICPC南京站

    K Co-prime Permutation 题意:给定n和k,让你构造n的排列,满足gcd(pi, i)=1的个数为k。 思路:因为x和x-1互质,1和任何数互质,任何数和它本身不互质 当k为奇数时,p1=1,后面k-1个数两两互换 当k为偶数时,后面k个数两两互换 Let\\\'s Play Curling 题意:给定n块红色石头,m块蓝色石头的位

    2024年02月10日
    浏览(29)
  • 2020ICPC南京【个人题解EFHKLM】

    首先如果炸弹在(0,0)或者机器人最终停在炸弹处,那么一定Impossible。 对于其他的情况,如果存在一条路径使得机器人可以不经过炸弹,那么一定存在一种方案,使得相同的方向在这个方案种是连在一起的。 于是可以直接枚举所有方向的排列,共4!个,判断每一种排列能否绕过

    2023年04月09日
    浏览(40)
  • XTU-OJ 1170-ICPC

    题目描述 ACM/ICPC比赛涉及的知识点非常多,一个队伍三个人需要能够互补。一个队伍某个知识点的高度是三个人中水平最高的那个人决定。现在给你三个人的每个知识点的水平情况,请计算一下这个队伍的水平。 输入 存在多个样例。每个样例的第一行是一个整数N(3≤N≤100

    2024年02月08日
    浏览(31)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包