#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
struct node {
int id;
int total;
int num;
bool flag;
int grade[5]= {-2,-2,-2,-2,-2};
} stu[100000];
bool cmp(node a,node b)
{
return a.total==b.total?(a.num==b.num?a.id<b.id:a.num>b.num):a.total>b.total;
}
int score[5];
int main()
{
int n,k,m;
cin>>n>>k>>m;
for(int i=0; i<k; i++)scanf("%d",&score[i]);
for(int i=0; i<m; i++) {
int id,pid,grade;
scanf("%d %d %d",&id,&pid,&grade);
pid--;
stu[id].id=id;
//if(grade==score[pid])stu[id].num++;
stu[id].grade[pid]=max(stu[id].grade[pid],grade);
}
for(int i=1; i<=n; i++) {
for(int j=0; j<k; j++) {
if(stu[i].grade[j]==score[j])stu[i].num++;
if(stu[i].grade[j]>=0) {
stu[i].total+=stu[i].grade[j]; //there is one passed the compiler.
stu[i].flag=true;
}
}
}
sort(stu+1,stu+1+n,cmp);
int rank=1;
for(int i=1; i<=n; i++) {
if(i>1&&stu[i].total!=stu[i-1].total)rank=i;
if(stu[i].flag) {
printf("%d %05d %d",rank,stu[i].id,stu[i].total);
for(int j=0; j<k; j++)if(stu[i].grade[j]!=-2) {
printf(" %d",stu[i].grade[j]==-1?0:stu[i].grade[j]);
} else printf(" -");
printf("\n");
}
}
return 0;
}
pta1075
猜你喜欢
转载自blog.csdn.net/ilikecarrots/article/details/86898251
今日推荐
周排行