当前位置:网站首页>SDUT 2446 final ranking
SDUT 2446 final ranking
2022-07-28 10:32:00 【Xiaoliu xuezha】
Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
The 4th Shandong University of Technology ACM After the network programming arena competition, a final ranking needs to be generated , The ranking depends on the number of questions . But there are too many teams involved , Manual ranking calculation can no longer meet the needs of the game . Now there's a list of teams ID And the number of questions made , You need to write a program , Generate the final ranking .
To simplify the topic , The ranking rule here is : The team with a large number of questions is at the front , If the number of questions is equal , Keep the relative order of input and don't change . Input
The first line contains a positive integer T( 1 ≤ T ≤ 15), Express T Group test data . The first row of each set of data has a positive integer N(1 < N ≤
10000), Indicates the number of teams . Next N Line contains two integers ,1 ≤ ID ≤ 10^7, 0 ≤ M ≤
100.ID Number the team ,M The number of questions made for .
Output
Each set of data output contains N That's ok , The first i Line has two integers ,ID and M Means to be in the i A team of ID And the number of questions made .
Sample Input
1
8
1 2
16 3
11 2
20 3
3 5
26 4
7 1
22 4
Sample Output
3 5
26 4
22 4
16 3
20 3
1 2
11 2
7 1
Hint
Source
#include <iostream>
#include <algorithm>
using namespace std;
struct s{
int a,b,c;
};
int c(s a,s b)
{
if(a.b==b.b){
return a.c<b.c;
}
return a.b>b.b;
}
int main()
{
int n;
cin>>n;
while(n--)
{
int m;
cin>>m;
s s[m];
for(int i=0;i<m;i++)
{
cin>>s[i].a>>s[i].b;
s[i].c=i;
}
sort(s,s+m,c);
for(int i=0;i<m;i++)
{
cout<<s[i].a<<" "<<s[i].b<<endl;
}
}
return 0;
}
边栏推荐
- Codeforces Round #614 (Div. 2) A. ConneR and the A.R.C. Markland-N
- 发力大核、独显!英众科技2020十代酷睿独显产品发布
- 11、链表反转
- It is said that the global semiconductor equipment giant may build a joint venture factory in Shanghai!
- The IPO of SMIC International Technology Innovation Board passed smoothly, and its market value is expected to exceed 200billion!
- 2020第二届传智杯初赛
- Add new startup logo and startup / shutdown animation in mt6735
- SQL Server 2016 学习记录 --- 嵌套查询
- 安装office自定义项 安装期间出错 解决办法
- pt-kill 查询中包含中文字符 导致工具失效的排查
猜你喜欢

SuperMap iServer发布管理以及调用地图服务

逆元&组合数&快速幂

ACM寒假集训#5

14. Double pointer - the container that holds the most water

Sword finger offer

Uni app project directory, file function introduction and development specification

ACM winter vacation training 5

SQL Server 2016 学习记录 --- 数据更新

SQL Server 2016学习记录 --- 连接查询

多线程与高并发(三)—— 源码解析 AQS 原理
随机推荐
Uni app advanced life cycle
按位与、或、异或等运算方法
16. String inversion
第一篇:UniAPP的小程序跨端开发-----创建uniapp项目
Ueeditor v1.4.3 control file compression
中兴通讯总裁徐子阳:5nm芯片将在2021年推出
a different object with the same identifier value was already associated with the session
ogg参数filter的使用问题【急】
管道、管程、管态的区别
配置树莓派,过程和遇到问题
吴雄昂遭Arm罢免内幕:建私人投资公司,损害了股东利益?
Huawei takes a 10% stake in fullerene technology, a graphene material manufacturer
LIBCMTD.lib
漏洞分析丨HEVD-0x8.IntegerOverflow[win7x86]
ACM寒假集训#6
ACM winter vacation training 6
SQL Server 2016 learning records - data update
Codeforces Round #614 (Div. 2) A. ConneR and the A.R.C. Markland-N
14、双指针——盛最多水的容器
9、删除链表中节点