1025. PAT Ranking (25)

简介: 来源#include #include #include using namespace std;struct student { long long int no; int score, fin...

来源

#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
struct student {
    long long int no;
    int score, finrank, loca, locarank;
};
bool cmp1(student a, student b) {
    return a.score != b.score ? a.score > b.score : a.no < b.no;
}
int main() {
    int n, m;
    scanf("%d", &n);
    vector<student> fin;
    for(int i = 1; i <= n; i++) {
        scanf("%d", &m);
        vector<student> v(m);
        for(int j = 0; j < m; j++) {
            scanf("%lld %d", &v[j].no, &v[j].score);
            v[j].loca = i;
        }
        sort(v.begin(), v.end(), cmp1);
        v[0].locarank = 1;
        fin.push_back(v[0]);
        for(int j = 1; j < m; j++) {
            v[j].locarank = (v[j].score == v[j - 1].score) ? (v[j - 1].locarank) : (j + 1);
            fin.push_back(v[j]);
        }
    }
    sort(fin.begin(), fin.end(), cmp1);
    fin[0].finrank = 1;
    for(int j = 1; j < fin.size(); j++)
        fin[j].finrank = (fin[j].score == fin[j - 1].score) ? (fin[j - 1].finrank) : (j + 1);
    printf("%d\n", fin.size());
    for(int i = 0; i < fin.size(); i++)
        printf("%013lld %d %d %d\n", fin[i].no, fin[i].finrank, fin[i].loca, fin[i].locarank);
    return 0;
}
目录
相关文章
|
3月前
|
机器学习/深度学习 算法 关系型数据库
Hierarchical Attention-Based Age Estimation and Bias Analysis
【6月更文挑战第8天】Hierarchical Attention-Based Age Estimation论文提出了一种深度学习方法,利用层次注意力和图像增强来估计面部年龄。通过Transformer和CNN,它学习局部特征并进行序数分类和回归,提高在CACD和MORPH II数据集上的准确性。论文还包括对种族和性别偏倚的分析。方法包括自我注意的图像嵌入和层次概率年龄回归,优化多损失函数。实验表明,该方法在RS和SE协议下表现优越,且在消融研究中验证了增强聚合和编码器设计的有效性。
27 2
|
算法 计算机视觉 知识图谱
ACL2022:A Simple yet Effective Relation Information Guided Approach for Few-Shot Relation Extraction
少样本关系提取旨在通过在每个关系中使用几个标记的例子进行训练来预测句子中一对实体的关系。最近的一些工作引入了关系信息
114 0
|
数据可视化 数据挖掘
【论文解读】Dual Contrastive Learning:Text Classification via Label-Aware Data Augmentation
北航出了一篇比较有意思的文章,使用标签感知的数据增强方式,将对比学习放置在有监督的环境中 ,下游任务为多类文本分类,在低资源环境中进行实验取得了不错的效果
333 0
PointNet++:Deep Hierarchical Feature Learning on Points Sets in a Metrci Space 学习笔记
PointNet++:Deep Hierarchical Feature Learning on Points Sets in a Metrci Space 学习笔记
74 0
|
机器学习/深度学习 存储 数据挖掘
【文本分类】Bag of Tricks for Efficient Text Classification
【文本分类】Bag of Tricks for Efficient Text Classification
【文本分类】Bag of Tricks for Efficient Text Classification
|
算法 Python
person correlation,spearman correlation and kendall's t的算法(python,算法来自FRM-market risk )
person correlation,spearman correlation and kendall's t的算法(python,算法来自FRM-market risk )
78 0
|
数据可视化 算法 数据挖掘
Evaluation of Clustering|学习笔记
快速学习 Evaluation of Clustering
Evaluation of Clustering|学习笔记
|
机器学习/深度学习 自然语言处理 搜索推荐
Re25:读论文 Lecut+JOTR Incorporating Retrieval Information into the Truncation of Ranking Lists in the
Re25:读论文 Lecut+JOTR Incorporating Retrieval Information into the Truncation of Ranking Lists in the
Re25:读论文 Lecut+JOTR Incorporating Retrieval Information into the Truncation of Ranking Lists in the
|
机器学习/深度学习 自然语言处理 数据挖掘
【1025】PAT Ranking (25 分)
【1025】PAT Ranking (25 分) 【1025】PAT Ranking (25 分)
100 0