当前位置:网站首页>Pat grade a 1025 pat ranking
Pat grade a 1025 pat ranking
2022-06-27 02:51:00 【IX. non random address】
Be careful ranking It's cumulative
#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
#include<vector>
using namespace std;
struct testee{
string ID;
int score;
int loc;
int wholerank;
int locrank;
};
bool compareloc(const testee &a, const testee &b){
if(a.score > b.score) return true;
else if(a.score < b.score) return false;
else if(a.score == b.score){
if(a.ID <= b.ID) return true;
else return false;
}
}
int main(void){
string s, s0, sk;
int m, n, k, i, j, f, h;
cin>>n;
vector<testee> v, vx;
testee tst;
vector<int> vtr;
for(i = 0; i < n; i++){
cin>>m;
vtr.push_back(m);
for(j = 0; j < m; j++){
cin>>tst.ID>>tst.score;
tst.loc = i + 1;
vx.push_back(tst);
}
}
h = 0;
for(i = 0; i < n; i++){
vector<testee> v0;
k = 1;
for(j = 0; j < vtr[i]; j++){
tst = vx[h++];
v0.push_back(tst);
}
sort(v0.begin(), v0.end(), compareloc);
if(v0.size()>0) v0[0].locrank = k;
for(j = 1; j < vtr[i]; j++){
k++;
if(v0[j - 1].score==v0[j].score) v0[j].locrank = v0[j - 1].locrank;
else v0[j].locrank = k;
}
for(j = 0; j < vtr[i]; j++) v.push_back(v0[j]);
}
k = 1;
sort(v.begin(), v.end(), compareloc);
if(v.size()>0) v[0].wholerank = k;
for(j = 1; j < v.size(); j++){
k++;
if(v[j - 1].score==v[j].score) v[j].wholerank = v[j - 1].wholerank;
else v[j].wholerank = k;
}
cout<<v.size()<<endl;
for(j = 0; j < v.size(); j++) cout<<v[j].ID<<" "<<v[j].wholerank<<" "<<v[j].loc<<" "<<v[j].locrank<<endl;
return 0;
} https://github.com/ZouJiu1/PAT
https://github.com/ZouJiu1/PAT
边栏推荐
- Summer planning for the long river
- Docker deploy redis cluster
- 测试nohup和&的各自作用
- 超级详细,2 万字详解,吃透 ES!
- Flink学习2:应用场景
- Questions and answers of chlor alkali electrolysis process in 2022
- Super détaillé, 20 000 caractères détaillés, mangez à travers es!
- Learn Tai Chi Maker - mqtt Chapter 2 (3) reserved messages
- 1、项目准备与新建
- PAT甲级 1026 Table Tennis
猜你喜欢

Super détaillé, 20 000 caractères détaillés, mangez à travers es!

1. Project preparation and creation

Mmdetection valueerror: need at least one array to concatenate solution

Don't be brainwashed. This is the truth about the wages of 90% of Chinese people

学习太极创客 — MQTT(九)ESP8266 同时订阅和发布 MQTT 消息

Geometric distribution (a discrete distribution)

PAT甲级 1026 Table Tennis

栈溢出漏洞
![[micro service sentinel] degradation rules slow call proportion abnormal proportion abnormal constant](/img/4d/4d4424b609a3c0cd36c5c79daa8861.png)
[micro service sentinel] degradation rules slow call proportion abnormal proportion abnormal constant

What if asreml-r does not converge in operation?
随机推荐
Oracle/PLSQL: NumToDSInterval Function
记录unity 自带读取excel的方法和遇到的一些坑的解决办法
Geometric distribution (a discrete distribution)
bluecms代码审计入门
超級詳細,2 萬字詳解,吃透 ES!
C language -- Design of employee information management system
Look! In June, 2022, the programming language ranking list was released! The first place is awesome
Flink学习2:应用场景
1、项目准备与新建
The use and introduction of pytorch 23 hook and the implementation of plug and play dropblock based on hook
STM32入门介绍
Overview of Tsinghua & Huawei | semantic communication: Principles and challenges
2022年氯碱电解工艺试题及答案
Window 加密壳实现
C# Tcp服务器如何限制同一个IP的连接数量?
学习太极创客 — MQTT(七)MQTT 主题进阶
参数估计——《概率论及其数理统计》第七章学习报告(点估计)
Constraintlayout Development Guide
学习太极创客 — MQTT(八)ESP8266订阅MQTT主题
lodash get js代码实现