简单模拟题。

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

如果一个人提交过的代码中有编译不通过的,也有通过的,那么那份编译不通过的记为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. mysql 表连接

    1.子查询是指在另一个查询语句中的SELECT子句. 例句: SELECT * FROM t1 WHERE column1 = (SELECT column1 FROM t2); 其中,SELECT ...

  2. java中list集合的内容,如何使用像数据库中group by形式那样排序

    java中list集合的内容,如何使用像数据库中group by形式那样排序,比如:有一个 List<JavaBean> 他中包含了一些如下的内容JavaBean:name    mone ...

  3. JVM调优总结-调优方法

    JVM调优工具 Jconsole,jProfile,VisualVM Jconsole : jdk自带,功能简单,但是可以在系统有一定负荷的情况下使用.对垃圾回收算法有很详细的跟踪 JProfiler ...

  4. Win7 Cygwin环境试验Nutch tutorial遇到的异常解决方法

    安装tutorial的步骤安装Nutch,当执行下面这条命令时出现异常 bin/nutch crawl urls - -topN Injector: starting at -- :: Injecto ...

  5. 授权给指定用户,使用navicat在其他ip都可以连接linux服务器上的mysql库

    grant all privileges on ao.* to 'tony'@'localhost' identified by '123456'; 在ao库中所有表. 同意 ,授权     给ton ...

  6. 根据字符串获取对应类型(Type) 转

    public static Type GetTypeByString(string type)        {            switch (type.ToLower())          ...

  7. ubuntu 连接VPN 命令

    1  注册MXVPN 2 启动VPN  pptpsetup --create mxvpn1 --server xx.xx.xx.xx --username *** --password *** --e ...

  8. 未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73”或它的某一个依赖项

    未能加载文件或程序集“ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf116 ...

  9. centos6.5安装docker

    (一) 查看系统的版本和内核: $cat /etc/issue $uname -r 因为docker要求服务CentOS6以上,kernel 版本必须2.6.32-431或更高 要将Docker安装到 ...

  10. getopt(分析命令行参数)

    ref:http://vopit.blog.51cto.com/2400931/440453   相关函数表头文件         #include<unistd.h>定义函数       ...