当前位置:网站首页>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
边栏推荐
- PAT甲级 1023 Have Fun with Numbers
- Flink learning 4:flink technology stack
- Learn Tai Chi maker mqtt (IX) esp8266 subscribe to and publish mqtt messages at the same time
- Learn from Taiji Maker - mqtt Chapter 2 (I) QoS service quality level
- Mmdetection uses yolox to train its own coco data set
- ConstraintLayout(约束布局)开发指南
- TP5 spreadsheet excel table export
- Shell script series (1) getting started
- Learn Tai Chi Maker - mqtt (VI) esp8266 releases mqtt message
- Overview of Tsinghua & Huawei | semantic communication: Principles and challenges
猜你喜欢

TechSmith Camtasia最新2022版详细功能讲解下载

Hot discussion: what are you doing for a meaningless job with a monthly salary of 18000?

Flink学习2:应用场景

Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk

Super detailed, 20000 word detailed explanation, thoroughly understand es!

TechSmith Camtasia latest 2022 detailed function explanation Download

Installing the Damon database using the command line

Parameter estimation -- Chapter 7 study report of probability theory and mathematical statistics (point estimation)

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

PAT甲级 1019 General Palindromic Number
随机推荐
Learn Tai Chi Maker - mqtt (VI) esp8266 releases mqtt message
Learn Tai Chi Maker - mqtt (VIII) esp8266 subscribe to mqtt topic
事业观、金钱观与幸福观
C language -- Design of employee information management system
元透实盘周记20220627
pytorch_ grad_ Cam -- visual Library of class activation mapping (CAM) under pytorch
Flink learning 2: application scenarios
The use and introduction of pytorch 23 hook and the implementation of plug and play dropblock based on hook
2022 operation of simulated examination platform for tea artist (Senior) work license question bank
Learn from Taiji Maker - mqtt Chapter 2 (I) QoS service quality level
Press key to control LED status reversal
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
2022 Chinese pastry (Advanced) recurrent training question bank and online simulation test
Cs5213 HDMI to VGA (with audio) single turn scheme, cs5213 HDMI to VGA (with audio) IC
Is the division of each capability domain of Dama, dcmm and other data management frameworks reasonable? Is there internal logic?
Sword finger offer 𞓜: stack and queue (simple)
Detailed explanation of ThreadLocal
Brief introduction of 228 dropout methods of pytorch and fast implementation of dropblock with 4 lines of code based on dropout
ConstraintLayout(约束布局)开发指南
dat. gui. JS star circle track animation JS special effect