当前位置:网站首页>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;
}
边栏推荐
- Go json.Decoder Considered Harmful
- Qt生成.exe文件 并 在无Qt环境下运行(Enigma Virtual Box进行绿色可执行软件封装)图文教程
- 中芯国际科创板IPO顺利过会,市值有望突破2000亿!
- Netease written test No. 2 -- typical application of European distance
- C语言 二级指针详解及示例代码
- 利用正则表达式从文件路径中匹配文件名
- 16. String inversion
- uni-app项目目录、文件作用介绍 及 开发规范
- Can kingbasees v8r6 JDBC use VIP?
- 20200217训练赛 L1 - 7 2019来了 (20分)
猜你喜欢

SQL Server 2016 learning record - Data Definition

安装office自定义项 安装期间出错 解决办法

机器学习--手写英文字母2--导入与处理数据

14、双指针——盛最多水的容器

SQL Server 2016学习记录 --- 单表查询

gcc: error trying to exec 'as': execvp: No such file or directory

Sword finger offer

Match file names from file paths using regular expressions

利用正则表达式从文件路径中匹配文件名

SDUT Round #9 2020-新春大作战
随机推荐
第11届蓝桥杯本科组校赛(20200321)
SQL Server 2016 学习记录 --- 数据更新
ACM winter vacation training 6
C language secondary pointer explanation and example code
Why does the cluster need root permission
SQL Server 2016 learning records - connection query
SQL Server 2016 学习记录 --- 数据定义
ACM寒假集训#7
DBeaver的操作日志
10. The penultimate node in the linked list
Idea create my first project
KingbaseES V8R6 JDBC 能否使用VIP ?
11、链表反转
Chapter 1: cross end development of small programs of uniapp ----- create a uniapp project
13. Hash table - the first common node of two linked lists
Ueeditor v1.4.3 control file compression
12、双指针——合并两个有序链表
利用正则表达式从文件路径中匹配文件名
UEditor V1.4.3控制文件压缩
Typora tutorial