简单模拟题。

注意一点:如果一个人所有提交的代码都没编译通过,那么这个人不计排名。

如果一个人提交过的代码中有编译不通过的,也有通过的,那么那份编译不通过的记为0分。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<algorithm>
using namespace std; const int maxn=+;
int n,k,m;
int val[]; struct X
{
int Rank;
int num;
int id;
int tot;
int get[];
}s[maxn],ans[maxn];
int sz; bool cmp(const X&a,const X&b)
{
if(a.tot==b.tot&&a.num==b.num) return a.id<b.id;
if(a.tot==b.tot) return a.num>b.num;
return a.tot>b.tot;
} int main()
{
scanf("%d%d%d",&n,&k,&m);
for(int i=;i<=k;i++) scanf("%d",&val[i]);
for(int i=;i<=n;i++)
{
s[i].id=i;
s[i].num=;
s[i].tot=;
for(int j=;j<=k;j++) s[i].get[j]=-;
} for(int i=;i<=m;i++)
{
int id,pro,get;
scanf("%d%d%d",&id,&pro,&get);
s[id].get[pro]=max(s[id].get[pro],get);
} sz=;
for(int i=;i<=n;i++)
{
int fail=;
for(int j=;j<=k;j++)
if(s[i].get[j]>=) fail=;
if(fail==) continue;
ans[sz++]=s[i];
} for(int i=;i<sz;i++)
for(int j=;j<=k;j++)
if(ans[i].get[j]==-) ans[i].get[j]=; for(int i=;i<sz;i++)
{
for(int j=;j<=k;j++)
{
if(ans[i].get[j]==-) continue;
ans[i].tot=ans[i].tot+ans[i].get[j];
if(ans[i].get[j]==val[j]) ans[i].num++;
}
} sort(ans,ans+sz,cmp); ans[].Rank=;
for(int i=;i<sz;i++)
{
if(ans[i].tot==ans[i-].tot)
ans[i].Rank=ans[i-].Rank;
else ans[i].Rank=i+;
} for(int i=;i<sz;i++)
{
printf("%d %05d %d",ans[i].Rank,ans[i].id,ans[i].tot);
for(int j=;j<=k;j++)
{
printf(" ");
if(ans[i].get[j]==-) printf("-");
else printf("%d",ans[i].get[j]);
}
printf("\n");
} return ;
}

PAT (Advanced Level) 1075. PAT Judge (25)的更多相关文章

  1. PTA(Advanced Level)1075.PAT Judge

    The ranklist of PAT is generated from the status list, which shows the scores of the submissions. Th ...

  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) 1071. Speech Patterns (25)

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

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

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

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

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

  9. PAT (Advanced Level) 1051. Pop Sequence (25)

    简单题. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> ...

随机推荐

  1. Chapter 1 First Sight——36

    The door opened again, and the cold wind suddenly gusted through the room, rustling the papers on th ...

  2. 其他应用和技巧-用try和catch来让程序更友好

    ---------------------------- <script type="text/javascript">                    //进行 ...

  3. data Mining with Weka: Trailer More Data Mining with Weka 用weka 进行数据挖掘 Weka 用weka 进行更多数据挖掘

    https://www.youtube.com/user/WekaMOOC 大学公开课  视频教程 weka 入门教程 data Mining with Weka: Trailer  More Dat ...

  4. hdu_5750_Dertouzos(线性筛)

    题目连接:hdu_5750_Dertouzos 题意: 给你一个n,一个d,问你比n小的数中有多少个数的最大的因子为d,比如6有因子1 2 3 最大的为3 题解: 当时比赛做这题的时候没考虑常数的优化 ...

  5. Encoded Love-letter

    Encoded Love-letter Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) ...

  6. vs远程调试

    一.远程       建立共享目录debug 二.本地 1.生成->输出->输出路径,由"bin\Debug\"改为远程目录"\\xxx\\debug&quo ...

  7. C# 将字符串转为&#2345;这种的 html实体编码

    1.字符串转为html实体编码 private string GetHtmlEntities(string str) { string r = string.Empty; ; i < str.L ...

  8. 扩展方法where方法查询不到数据,不会抛异常,也不是返回的null

    如题,“扩展方法where方法查询不到数据,不会抛异常,也不是返回的null”,示例代码如下: Product类: public class Product { private string name ...

  9. 重启oracle数据库的一次操作命令和alter日志。

    今天重启oracle数据库的命令和alter日志: oracle@NMSSERVER1:~> sqlplus '/as sysdba' SQL*Plus: Release 11.2.0.3.0 ...

  10. POJ 2082Lost Cows<>

    题意: 给出一个序列a[1....n],a[i]代表在0....i-1中比a[i]小的个数. 求出这个序列. 思路: 1:暴力. #include<cstdio> #include< ...