当前位置:网站首页>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
边栏推荐
- Fork (), exec (), waitpid (), $? > > in Perl 8 combination
- JWT certification process and use cases
- bluecms代码审计入门
- Flink学习4:flink技术栈
- 剑指Offer || :栈与队列(简单)
- h5液体动画js特效代码
- pytorch_grad_cam——pytorch下的模型特征(Class Activation Mapping, CAM)可视化库
- PAT甲级 1026 Table Tennis
- C # check whether the date is in the correct format
- 超级详细,2 万字详解,吃透 ES!
猜你喜欢

栈溢出漏洞

Detailed explanation of ThreadLocal

CVPR2022 | PointDistiller:面向高效紧凑3D检测的结构化知识蒸馏

QIngScan使用

超级详细,2 万字详解,吃透 ES!

超級詳細,2 萬字詳解,吃透 ES!

Cs5213 HDMI to VGA (with audio) single turn scheme, cs5213 HDMI to VGA (with audio) IC

Would rather go to 996 than stay at home! 24 years old, unemployed for 7 months, worse than work, no work

Why pass SPIF_ Sendchange flag systemparametersinfo will hang?

What if asreml-r does not converge in operation?
随机推荐
【数组】剑指 Offer II 012. 左右两边子数组的和相等 | 剑指 Offer II 013. 二维子矩阵的和
PAT甲级 1020 Tree Traversals
Flink学习4:flink技术栈
参数估计——《概率论及其数理统计》第七章学习报告(点估计)
Oracle/PLSQL: From_ Tz function
解决cherry pick提交报错问题
Laravel 的 ORM 缓存包
Super détaillé, 20 000 caractères détaillés, mangez à travers es!
Installing the Damon database using the command line
执念斩长河暑期规划
TechSmith Camtasia latest 2022 detailed function explanation Download
学习太极创客 — MQTT 第二章(三)保留消息
Record the method of reading excel provided by unity and the solution to some pits encountered
2022中式面点师(高级)复训题库及在线模拟考试
ConstraintLayout(约束布局)开发指南
Svg drag dress Kitty Cat
Shell script series (1) getting started
Yuantou firm offer weekly record 20220627
记录unity 自带读取excel的方法和遇到的一些坑的解决办法
元透实盘周记20220627