#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespace std;struct Admission{ int Ge; int Gi; int finalGrade; int rank; int choice[5]; int id;}adm[40010];struct School{ int quo; int num; int admId[40010]; int lastId;}sch[110];bool cmp(Admission a, Admission b){ if (a.finalGrade != b.finalGrade) return a.finalGrade > b.finalGrade; else return a.Ge > b.Ge;}bool cmp1(int a,int b){ return a < b;}int main(){ int n, m, k; scanf("%d%d%d", &n, &m, &k); for (int i = 0; i < m; i++){ int a; scanf("%d", &a); sch[i].quo = a; sch[i].lastId = -1; sch[i].num = 0; } for (int i = 0; i < n; i++){ scanf("%d %d", &adm[i].Ge, &adm[i].Gi); adm[i].finalGrade = adm[i].Ge + adm[i].Gi; for (int j = 0; j < k; j++){ scanf("%d", &adm[i].choice[j]); } adm[i].id = i; } sort(adm, adm + n, cmp); for (int i = 0; i < n; i++){ if (i != 0 && adm[i].finalGrade == adm[i - 1].finalGrade && adm[i].Ge == adm[i - 1].Ge) adm[i].rank = adm[i - 1].rank; else adm[i].rank = i; } for (int i = 0; i < n; i++){ for (int j = 0; j < k; j++){ int ch = adm[i].choice[j]; if (sch[ch].num < sch[ch].quo || adm[sch[ch].lastId].rank == adm[i].rank){ sch[ch].admId[sch[ch].num++] = adm[i].id; sch[ch].lastId = i; break; } } } for (int i = 0; i < m; i++){ if (sch[i].num){ sort(sch[i].admId, sch[i].admId + sch[i].num, cmp1); for (int j = 0; j < sch[i].num; j++){ PRintf("%d", sch[i].admId[j]); if (j != sch[i].num - 1) printf(" "); } } printf("/n"); } return 0;}
新闻热点
疑难解答