PAT (Advanced Level) 1025. PAT Ranking (25)
简单题。
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<string>
#include<vector>
using namespace std; const int maxn=;
int n,tot=;
int sz[maxn];
struct X
{
string id;
int c;
int ans1,ans2,ans3;
}s[+]; bool cmp(const X&a,const X&b)
{
return a.c>b.c;
} bool cmp1(const X&a,const X&b)
{
if(a.ans1==b.ans1) return a.id<b.id;
return a.ans1<b.ans1;
} int main()
{
scanf("%d",&n); int sum=;
for(int i=;i<=n;i++)
{
scanf("%d",&sz[i]);
for(int j=;j<=sz[i];j++)
{
++tot;
cin>>s[tot].id;
cin>>s[tot].c;
s[tot].ans2=i;
}
sort(s+sum+,s++tot,cmp);
s[sum+].ans3=;
for(int i=sum+;i<=tot;i++)
{
if(s[i].c==s[i-].c) s[i].ans3=s[i-].ans3;
else s[i].ans3=i-sum;
}
sum=tot;
}
sort(s+,s+tot+,cmp);
s[].ans1=;
for(int i=;i<=tot;i++)
{
if(s[i].c==s[i-].c) s[i].ans1=s[i-].ans1;
else s[i].ans1=i;
}
sort(s+,s+tot+,cmp1); printf("%d\n",tot);
for(int i=;i<=tot;i++)
{
cout<<s[i].id;
printf(" %d %d %d\n",s[i].ans1,s[i].ans2,s[i].ans3);
}
return ;
}
PAT (Advanced Level) 1025. PAT Ranking (25)的更多相关文章
- PTA(Advanced Level)1025.PAT Ranking
To evaluate the performance of our first year CS majored students, we consider their grades of three ...
- PAT (Advanced Level) 1114. Family Property (25)
简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...
- PAT (Advanced Level) 1109. Group Photo (25)
简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...
- PAT (Advanced Level) 1105. Spiral Matrix (25)
简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<map> #incl ...
- PAT (Advanced Level) 1101. Quick Sort (25)
树状数组+离散化 #include<cstdio> #include<cstring> #include<cmath> #include<map> #i ...
- PAT (Advanced Level) 1075. PAT Judge (25)
简单模拟题. 注意一点:如果一个人所有提交的代码都没编译通过,那么这个人不计排名. 如果一个人提交过的代码中有编译不通过的,也有通过的,那么那份编译不通过的记为0分. #include<cstd ...
- PAT (Advanced Level) 1071. Speech Patterns (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT (Advanced Level) 1063. Set Similarity (25)
读入之后先排序. 询问的时候可以o(m)效率得到答案. #include<cstdio> #include<cstring> #include<cmath> #in ...
- PAT (Advanced Level) 1059. Prime Factors (25)
素因子分解. #include<iostream> #include<cstring> #include<cmath> #include<algorithm& ...
随机推荐
- 暴力+树状数组维护 Codeforces Round #378 (Div. 2) C
题目大意:给你一个长度为n的数组a,然后数值大的可以合并数值小的,且合并了以后该数组的长度-1.给你一个长度为k目标数组b,问,是否可以从a数组变到b数组,是就yes并且输出步骤.否就输出no 思路: ...
- 笨方法学python--打印
1 print 语句 尾端的逗号 end1 = "C" end2 = "h" end3 = "e" end4 = "e" ...
- transform 属性小解
css中transform包括三种: 旋转rotate(), translate()移动, 缩放scale(), skew()扭曲以及矩形变换matrix() 语法: transform: none ...
- undefined与null
undefined 声明的变量尚未初始化 null 对象尚未存在 eg: var a; console.log(typeof a); 输出undefined var b= document.getEl ...
- 转 : ANT 调用sqlplus 客户端
Jenkins安装与配置 (版本控制) 1 用ant脚本执行sql语句现在我需要写一个ant脚本来实现项目安装,情况是这样的,客户现在运行的版本可能是2.0,安装目录里可能有REL_1_0,REL_ ...
- VHD进阶:差分VHD备份系统
VHD进阶:差分VHD备份系统 一.创建虚拟磁盘 方法1:图形界面创建 1.打开磁盘管理器(运行diskmgmt.msc),在“磁盘管理”上点击右键,“创建VHD”,类型选择VHD,动态扩展或者固定大 ...
- 为什么Hbase能实现快速的查询
你的快速是指什么? 是根据亿级的记录中快速查询,还是说以实时的方式查询数据. A:如果快速查询(从磁盘读数据),hbase是根据rowkey查询的,只要能快速的定位rowkey, 就能实现快速的查询 ...
- 转:HTML错误编号大全
HTML错误编号大全 状态行包含HTTP版本.状态代码.与状态代码对应的简短说明信息.在大多数情况下,除了Content-Type之外的所有应答头都是可选的.但Content-Type是必需的,它描述 ...
- 解决IIS网站.woff 404 (Not Found)问题
一.在没有权限操作IIS管理器的情况下,在Web.config中的system.webServer节点进行如下配置: <system.webServer> <staticConten ...
- Ubuntu下使用rpm 软件包
Ubuntu的软件包格式是deb,如果要安装rpm的包,则要先用alien把rpm转换成deb. sudo apt-get install alien sudo alien xxxx.rpm #将rp ...