#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int maxn=10010;
struct User{
int id;
int grade[7]={-1,-1,-1,-1,-1,-1,-1};
int total=-1,perfect=0;
bool flag=false;
}user[maxn];
int p[7];
bool cmp(User a,User b){
if(a.total!=b.total) return a.total>b.total;
else if(a.perfect!=b.perfect) return a.perfect>b.perfect;
else return a.id<b.id;
}
void calTotal(int N,int K)
{
for(int i=1;i<=N;i++){
if(user[i].flag) user[i].total=0;
else continue;
for(int j=1;j<=K;j++){
if(user[i].grade[j]!=-1) user[i].total+=user[i].grade[j];
}
}
}
void printInfo(int N,int K)
{
int k=1;
printf("1 %05d %d",user[1].id,user[1].total);
for(int i=1;i<=K;i++){
if(user[1].grade[i]!=-1) printf(" %d",user[1].grade[i]);
else printf(" -");
}
printf("\n");
for(int i=2;i<=N;i++){
if(user[i].total<0) break;
if(user[i].total==user[i-1].total){
printf("%d %05d %d",k,user[i].id,user[i].total);
}else{
printf("%d %05d %d",i,user[i].id,user[i].total);
k=i;
}
for(int j=1;j<=K;j++){
if(user[i].grade[j]!=-1) printf(" %d",user[i].grade[j]);
else printf(" -");
}
printf("\n");
}
}
int main()
{
int N,K,M;
scanf("%d%d%d",&N,&K,&M);
for(int i=1;i<=K;i++){
scanf("%d",&p[i]);
}
for(int i=1;i<=M;i++){
int id,index,score;
scanf("%d%d%d",&id,&index,&score);
if(score!=-1){
user[id].flag=true;
user[id].id=id;
if(user[id].grade[index]<score){
if(score==p[index]) user[id].perfect++;
user[id].grade[index]=score;
}
}else{
if(user[id].grade[index]==-1) user[id].grade[index]=0;
}
}
calTotal(N,K);
sort(user+1,user+1+N,cmp);
printInfo(N,K);
return 0;
}
注意一下提交了编译未通过的输出的是0而不是 ‘-’