简单题。

#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)的更多相关文章

  1. PTA(Advanced Level)1025.PAT Ranking

    To evaluate the performance of our first year CS majored students, we consider their grades of three ...

  2. PAT (Advanced Level) 1114. Family Property (25)

    简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...

  3. PAT (Advanced Level) 1109. Group Photo (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  4. PAT (Advanced Level) 1105. Spiral Matrix (25)

    简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<map> #incl ...

  5. PAT (Advanced Level) 1101. Quick Sort (25)

    树状数组+离散化 #include<cstdio> #include<cstring> #include<cmath> #include<map> #i ...

  6. PAT (Advanced Level) 1075. PAT Judge (25)

    简单模拟题. 注意一点:如果一个人所有提交的代码都没编译通过,那么这个人不计排名. 如果一个人提交过的代码中有编译不通过的,也有通过的,那么那份编译不通过的记为0分. #include<cstd ...

  7. PAT (Advanced Level) 1071. Speech Patterns (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  8. PAT (Advanced Level) 1063. Set Similarity (25)

    读入之后先排序. 询问的时候可以o(m)效率得到答案. #include<cstdio> #include<cstring> #include<cmath> #in ...

  9. PAT (Advanced Level) 1059. Prime Factors (25)

    素因子分解. #include<iostream> #include<cstring> #include<cmath> #include<algorithm& ...

随机推荐

  1. Eclipse 安装 HDFS 插件

    Eclipse 安装 hdfs 连接插件 1.插件安装 在$HADOOP_HOME/contrib/eclipse-plugin/文件夹中有个hadoop-eclipse-plugin-0.20.20 ...

  2. Windows中安装jdk,出现javac不是内部或外部命令 也不是可运行的程序

    在经过多次实验,终于解决了在dos窗口验证jdk是否安装成功的错误提示-----javac不是内部或外部命令 也不是可运行的程序 首先要明确的是 在新建 JAVA_HOME , CLASSPATH文件 ...

  3. setTranslucent

    在ios7中 如果setTranslucent=yes 默认的   则状态栏及导航栏底部为透明的,界面上的组件应该从屏幕顶部开始显示,因为是半透明的,可以看到,所以为了不和状态栏及导航栏重叠,第一个组 ...

  4. Win7 “Bluetooth设置”对话框无法打开,及无法查找到设备

    方法是在百度上找到的,试用成功. 1.打开开始菜单中的运行选项,然后在对话框中输入services.msc,回车打开服务界面: 2.然后在弹出来的服务窗口中查找到Bluetooth Support S ...

  5. table详解

    1.tr 元素定义表格行,th 元素定义表头,td 元素定义表格单元. tr内是th还是td可由自己定义,th,td可存在于任一行,th与td的区别在与th字体更粗 2.定义一个table默认有bor ...

  6. hdu5269 ZYB loves Xor I

    分治法和字典树都可以,都是递归,但字典树耗内存 从第一bit开始,若相同则xor为0,分到同一部分,不相同则统计,且此时lowbit为这一bit,最后结果要乘以2 /*分治法*/ #include&l ...

  7. CodeIgniter 如何去掉 Index.php

    步骤; 1.打开你的WEB服务器的httpd.conf文件. 2.找到LoadModule rewrite_module modules/mod_rewrite.so这行,把该行前的#去掉.保存该文件 ...

  8. stdafx文件介绍

    MSDN介绍: These files are used to build a precompiled header file Projname.pch and a precompiled types ...

  9. 【转】Java 内部类种类及使用解析

    Java 内部类种类及使用解析 内部类Inner Class 将相关的类组织在一起,从而降低了命名空间的混乱. 一个内部类可以定义在另一个类里,可以定义在函数里,甚至可以作为一个表达式的一部分. Ja ...

  10. 快学Scala-第六章 对象

    知识点: 1.单例对象 使用object语法结构达到静态方法和静态字段的目的,如下例,对象定义某个类的单个实例,包含想要的特性,对象的构造器在该对象第一次被使用时调用. object Account{ ...