B1080 Graduate Admission (填志愿录取模拟)

B1080 Graduate Admission (30分)

  • If there is a tied final grade, the applicants will be ranked according to their national entrance exam grade G​E

  • If still tied, their ranks must be the same.
    If there is a tied rank, and if the corresponding applicants are applying to the same school, then that school must admit all the applicants with the same rank, even if its quota will be exceeded.

该题录取需要记录Rank,卡了一晚上的测试点1两分过不去,因为我自己在想到录取按最后一个人是否到达分数线,而忽略了题中指的是达到Rank,因为G和GE相等,Rank相等,但是总分不一定相等。

另外要注意的地方

  • GI和GE相加*2不会超int,题中没讲是否是整型,最好不要去除2比较G,避免了化整需要讨论的四舍五入
  • vectora[MAX]的sort排序:
    1.sort(a[i].begin(),a[i].end())
    2.重写一个结构体,结构体里加vectorb
    sort(a[i].b.begin(),a[i].b.end());

对vectora[MAX]的排序下次不要去搞什么sort(a[i],a[i]+m,cmp)了!!!

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define lowbit(i)((i)&(-i))
using namespace std;
typedef long long ll;
const int MAX=40005;
const int INF=0x3f3f3f3f;
const int MOD=1000000007;
const int SQR=633;
int n,m,k;
int school[101];
mapminscore;
maplocal;
struct node
{
    int GE,GI,G;
    int Rank;
    int id;
    int d[6];
}stu[MAX];
vectorsch[101];
bool cmp(node a,node b)
{
    if(a.G!=b.G)
        return a.G>b.G;
    else
        return a.GE>b.GE;
}
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i=1)
        {
            sch[stu[i].d[j]].push_back(stu[i].id);
            school[stu[i].d[j]]--;
            minscore[stu[i].d[j]]=stu[i].Rank;
            local[stu[i].d[j]]=j;
            break;
        }
        else if(school[stu[i].d[j]]==0&&minscore[stu[i].d[j]]==stu[i].Rank&&local[stu[i].d[j]]==j)
        {
             sch[stu[i].d[j]].push_back(stu[i].id);
             break;
        }
       }
    }
    for(int i=0;i

你可能感兴趣的:(B1080 Graduate Admission (填志愿录取模拟))