简单题。

#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. HAProxy与varnish

    Even if HAProxy can do TCP proxying, it is often used in front of web application, exactly where we ...

  2. Entity Framework 学习高级篇2—改善EF代码的方法(下)

    ,IQueryable<Customers>>( (database) => database.Customers.Where(c => c.City == " ...

  3. UITextfield的一些属性

    //设置左视图 不用设置frame UIImageView *imageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@&quo ...

  4. Windsock套接字I/O模型学习 --- 第一章

    1. I/O模型共有以下几种: 阻塞(blocking)模型 选择(select)模型 WSAAsyncSelect模型 WSAEventSelect模型 重叠(overlapped)模型 完成端口( ...

  5. iOS生成一个32位的UUID

    - (NSString *)uuidString { CFUUIDRef uuid_ref = CFUUIDCreate(NULL); CFStringRef uuid_string_ref= CFU ...

  6. CRT堆

    实验环境:win764位旗舰版.VS2010旗舰版 每个进程都有一个默认堆,在进程初始化的时候会创建这个默认堆,可以通过GetProcessHeap()获取默认堆的句柄.使用CRT时,也会有一个CRT ...

  7. fidder 调试本地文件

  8. Android自定义XML属性

    <?xml version="1.0" encoding="utf-8"?> <resources> <declare-style ...

  9. CentOS安装VirtualBox增强工具

    安装过程中出现错误: Bulding the VirtualBox Guest Additions Kernel modules failedYour system does not seem to  ...

  10. android--listview设置高度

    android:layout_height="25dp"这么设置根本就没有用. 我们必须要设置android:minHeight="25dp"这样才行.