题目大意:给出N个考场的所有考生的信息,要求按照成绩排名,输出每个考生的 总排名、考场排名、和所在考场。
排序题,输入完每个考场的考生信息时,可以一次排序得到该考生的考场排名,输入完全部考场信息后再来一次排序,可以得到所有考生的总排名。
AC代码:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
struct student
{
string id;
int score;
int finalRank;
int localRank;
int location;
student(string id, int score, int location):id(id), score(score), location(location){};
bool operator< (const student &other)
{
if(this->score != other.score) return this->score > other.score;
return this->id < other.id;
}
};
int main()
{
int N;
cin >> N;
vector<student> totalStu;
for (int i = 1; i <= N; ++i)
{
int K;
cin >> K;
vector<student> v;
for (int j &#