1075 PAT Judge (25 point(s))

UCOS-III 系统移植 UCOSIII系统移植到GD32F303详细过程 工程代码:https://github.com/jslaobing/techIot_ucosiii_porting 阅读详情

1075 PAT Judge (25 point(s))

The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.

Input Specification:

Each input file contains one test case. For each case, the first line contains 3 positive integers, N (≤10​4​​), the total number of users, K (≤5), the total number of problems, and M (≤10​5​​), the total number of submissions. It is then assumed that the user id's are 5-digit numbers from 00001 to N, and the problem id's are from 1 to K. The next line contains K positive integers p[i] (i=1, ..., K), where p[i] corresponds to the full mark of the i-th problem. Then M lines follow, each gives the information of a submission in the following format:

user_id problem_id partial_score_obtained

where partial_score_obtained is either −1 if the submission cannot even pass the compiler, or is an integer in the range [0, p[problem_id]]. All the numbers in a line are separated by a space.

Output Specification:

For each test case, you are supposed to output the ranklist in the following format:

rank user_id total_score s[1] ... s[K]

where rank is calculated according to the total_score, and all the users with the same total_score obtain the same rank; and s[i] is the partial score obtained for the i-th problem. If a user has never submitted a solution for a problem, then "-" must be printed at the corresponding position. If a user has submitted several solutions to solve one problem, then the highest score will be counted.

The ranklist must be printed in non-decreasing order of the ranks. For those who have the same rank, users must be sorted in nonincreasing order according to the number of perfectly solved problems. And if there is still a tie, then they must be printed in increasing order of their id's. For those who has never submitted any solution that can pass the compiler, or has never submitted any solution, they must NOT be shown on the ranklist. It is guaranteed that at least one user can be shown on the ranklist.

Sample Input:

7 4 20
20 25 25 30
00002 2 12
00007 4 17
00005 1 19
00007 2 25
00005 1 20
00002 2 2
00005 1 15
00001 1 18
00004 3 25
00002 2 25
00005 3 22
00006 4 -1
00001 2 18
00002 1 20
00004 1 15
00002 4 18
00001 3 4
00001 4 2
00005 2 -1
00004 2 0

Sample Output:

1 00002 63 20 25 - 18
2 00005 42 20 0 22 -
2 00007 42 - 25 - 17
2 00001 42 18 18 4 2
5 00004 40 15 0 25 -

常规模拟题,难度中档。主要是要理清思路,不要陷入混乱,尽可能减少代码量。

涉及点:1. 结构体的灵活使用(函数、重载运算符等);2.名次赋值

此题因为限制了K范围不大于5,因此直接在结构体中设置那么多数组,不会占用太多内存,如果K太大可能导致MLE。

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N,K,M;//users pros submissions
struct user{
	int id;int rank;
	bool isSolved[6]={false};
	bool isCompiled[6]={false};
	bool hasSubmitted[6]={false};
	bool isShown=false;
	int marks[6];
	int solvedCnt=0;
	int totalScore=0;
	void shown(){
		for(int i=1;i<=K;i++){
			if(isCompiled[i]){
				isShown=true;break;
			}
		}
	}
	void scoreSum(){
		for(int i=1;i<=K;i++) totalScore+=marks[i];
	}
	void solvedSum(){
		for(int i=1;i<=K;i++){
			if(isSolved[i]) solvedCnt++;
		}
	}
	bool operator < (const user &other) const{
		if(totalScore!=other.totalScore) return totalScore>other.totalScore;
		if(solvedCnt!=other.solvedCnt) return solvedCnt>other.solvedCnt;
		return id<other.id;
	}
};
const int MAX = 1e4+7;
int full[6];
user U[MAX];
int main(void){
	cin>>N>>K>>M;
	for(int i=1;i<=N;i++){
		U[i].id = i;
	}
	for(int i=1;i<=K;i++) cin>>full[i];
	int id,proid,score;
	while(M--){
		cin>>id>>proid>>score;
		U[id].hasSubmitted[proid]=true;
		if(score>=0){
			U[id].isCompiled[proid] = true;
			if(score>U[id].marks[proid]){
				U[id].marks[proid]=score;
				if(score==full[proid]){
					 U[id].isSolved[proid] = true;
				}
			}
		}
	}
	for(int i=1;i<=N;i++){
		U[i].scoreSum();
		U[i].solvedSum();
		U[i].shown();
	}
	sort(U+1,U+N+1);
	for(int i=1;i<=N;i++){
		if(i==1||U[i].totalScore!=U[i-1].totalScore){
			U[i].rank=i;
		} else if(U[i].totalScore==U[i-1].totalScore){
			U[i].rank=U[i-1].rank;
		}
	}
	for(int i=1;i<=N;i++){
		if(U[i].isShown){
			printf("%d %05d %d",U[i].rank,U[i].id,U[i].totalScore);
			for(int j=1;j<=K;j++){
				if(U[i].hasSubmitted[j]==false ) cout<<" -";
				else cout<<" "<<U[i].marks[j];
			}
			cout<<endl;
		}
	}
	return 0;
}

 

推荐系统(十六):基于ESMM的商品召回/推荐系统 ESMM(Entire Space Multi-Task Model)是阿里巴巴提出的多任务学习框架,通过联合建模点击率(CTR)和点击转化率(CVR)解决传统CVR模型样本稀疏问题。其核心思想是将 CVR 定义为 CTR 与 CTCVR 的条件概率,模型包含两个子任务。 阅读详情

相关推荐

FPGA加速SNN实现MNIST手写数字识别的实践与优化

脉冲神经网络(SNN)作为第三代神经网络模型,采用生物启发的脉冲事件驱动机制,在处理时序信号时具有天然能效优势。其核心原理是通过神经元仅在接收足够输入脉冲时激活的稀疏特性,大幅降低计算能耗。在FPGA硬件加速领域,SNN通过量化优化、硬件友好型神经元模型设计等关键技术,可在边缘计算场景实现超高能效比。本文以MNIST手写数字识别为案例,详细解析了从6bit量化策略到双缓冲流水线设计的完整优化路径,最终在Xilinx Kintex-7平台实现97.54%识别准确率的同时,功耗仅231mW,能效比达81,712

weixin_30417487的博客 529

1075 PAT Judge (25 point(s))

题解 vv.resize(int n,element)表示调整容器vv的大小为n,扩容后的每个元素的值为element,默认为0 resize()会改变容器的容量和当前元素个数  #include&lt;cstdio&gt; #include&lt;string&gt; #include&lt;vector&gt; #include&lt;algorithm&gt; using na...

徐伯莱 285

Ansys Lumerical 启动时出现 Error: Could not connect to Ansys license server specified at 1055@ 的一种解决办法

考虑到 2020 版的时候是直接在全局变量里指定具体地址,但是 2024 版本是写成 1055@localhost ,并且之后在站里搜相关 Ansys 的问题都指向 1055 端口被占用,虽然问题不一样,但是本着死马当活马医,就按照。我最近在跑超透镜结构,听说2024版本现在有GPU加速可以用,就把Lumerical从2020升到2024版本,结果发现一开头的破解办法完全不一样了。一开始安装的时候以为2020没有删干净,导致2024版的安装一直锁着目标地址,解决办法参考。的办法来操作,在关闭了。

qq_51404184的博客 5759

1075 PAT Judge (25 分)(排序)

1075 PAT Judge (25 分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specification...

virgilshi的博客 331

逆向某团mtgsig参数时,我踩过的3个坑:从H5guard混淆到Python校验

本文详细解析了逆向某团mtgsig参数时遇到的三大挑战:H5guard混淆破解、环境补全检测与Python结果校验。通过实战案例,揭示了JavaScript加密算法的逆向技巧,包括控制流混淆拆解、隐蔽环境检测点规避以及跨语言校验的解决方案,为开发者提供了一套完整的逆向工程避坑指南。

weixin_27722377的博客 1065

基于Python适用于YOLO目标检测算法的图片数据增强处理

为了增强模型的鲁棒性以及数据的丰富性,同 时为了防止由于数据过少发生过拟合,本设计对数 据集进行数据增强处理,包括随机亮度调节、随机 对比度调节、随机饱和度调节、加入高斯噪声、水 平翻转、运动模糊和旋转 15°

weixin_67136409的博客 700

1075 PAT Judge (25 分)

今天这道题真的虐哭我了,思路不难,但是,真的是细节,各种各种细节需要注意。终于所有测试用例都通过了,可是这个时候,只能吃泡面了。So sad….. Ok,切换频道: 1075 PAT Judge (25 分) The ranklist of PAT is generated from the status list, which shows the scores of the submiss...

超级酷的鬼鬼珊 2659

Anroid8.1 强制修改系统可以adb remount

在Android6.0 (Android M)user版本上,发现使用adb root后再adb remount系统之后会提示这样信息:remount of /system failed: Read-only file system,这是不能对system分区进行操作,提示没有写权限,为只读文件系统Read-only file system,因为系统本身在user就不支持可写操作,我们就不能adb push来调试apk,如果想调试apk就需要修改system、vendor权限问题。 如下现象: C:\Use

wq892373445的博客 1408

PAT A1075. PAT Judge (25)

题目链接 注意边界条件,代码如下: #include #include #include using namespace std; int fmark[6]; //注意边界条件,例如6号提交了,但得分为0,仍需要输出 //所以在结构体中,设置flag来表示是否有“通过编译的提交” //如果有,则flag记为true struct User {     int id, sc

DimonsInside的博客 438

【YOLOv11】087、YOLOv11多任务学习:检测、分割、分类联合学习

摘要: 工业质检场景中,多任务模型(检测、分类、分割)的需求日益增长。针对边缘设备部署的挑战,本文提出基于YOLOv11的多任务学习方案。通过共享主干网络和设计分支头(检测、分割、分类),实现高效推理;采用动态权重平衡策略解决多任务损失不平衡问题;并优化数据流处理(支持部分标注)和推理剪裁(按需启用分支)。实验表明,该方法在Jetson Orin上帧率提升3倍,内存占用减少40%,为工业质检提供了轻量高效的解决方案。

企鹅码农的专属播客,分享10多年的实战案例和经验解读,包含YOLO、RT-DETR、AI等各个工作领域。 447

新手必读!2025最全AI智能体入门手册,50个问题全讲透

感知(Perception):能读取环境,比如读取网页数据、识别用户输入、接入 API;思考(Reasoning/Planning):理解任务目标,规划出行动步骤;行动(Action):调工具、查资料、发消息、写入数据库……直接执行任务。有了这三步,智能体才不是“一个会说话的大模型”,而是真正的“能落地执行的工作代理人”。多个 Agent 分工协作,每个智能体负责一个角色或任务节点,像一个“虚拟团队”。一个爬数据的 Agent,一个提炼要点的 Agent,一个撰写报告的 Agent,

互联网架构师笔记 1971

PTA甲级1075 PAT Judge (25point(s))

首先,先贴柳神的博客 https://www.liuchuo.net/ 这是地址 想要刷好PTA,强烈推荐柳神的博客,和算法笔记 题目原题 The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to ge...

Huangpengyu123的博客 347

GEE:连续变化检测 CCD 第一步(导出ee.Algorithms.TemporalSegmentation.Ccdc函数的结果)

连续变化检测与分类(Continuous Change Detection and Classification, CCDC)主要有两个组件,一个连续变化检测 CCD,另外一个分类。在 Google Earth Engine (GEE)平台上进行 CCD 时间序列变化检测的时候,为了防止内存超限问题,将代码分为2阶段执行。第一阶段是运行 `ee.Algorithms.TemporalSegmentation.Ccdc` 函数,本文将详细介绍 CCD 的第一阶段的代码。

养乐多的博客 2497

1075 PAT Judge (25point(s))

1075 PAT Judge (25point(s)) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specification: Each input file contains one test case. For each

佳迪斯的博客 146

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

【PAT】A1075 PAT Judge (25point(s))

文章目录A1075 PAT Judge (25point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis Author: CHEN, Yue Organization: 浙江大学 Time Limit: 200 ms Memory Limit: 64 MB Code Size L...

Duke 292

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

1075 PAT Judge (25point(s)) - C语言 PAT 甲级

排序题,按照题目排序输出即可 * 只要有一题编译通过,此考生即可参与排名, * 可以参与排名,但有编译未通过的题目,视为 0 分记录 * 输入数据时,`-` 代表编译未通过,而输出数据时 `-` 代表未提交

有三只土豆 193

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

PAT(甲级)1075 PAT Judge (25point(s))

题目 题目链接 思路 题目大意:这道题分的情况有点多啊。首先是排序标准,一共有3个标尺,第一标尺是总分由高到低,第二标尺是完美题解(也就是完全正确的题目数量)由多到少,第三标尺是id由小到大; 排序前要做的准备工作是把每个人的总分,完美解题数量求出来; 由于最后输出时全部提交都没有通过编译或者没有提交的人不参与排名,也就是不输出,所以要用一个标记来判断这个人是不是需要参与排名;具体实现是读入每个人的分数是,如果分数不是-1,那么说明有通过编译的提交,则需要参加排名; 其次要注意如果一个题没有通过编译,但是这

hjyp的博客 238

PAT A1075 PAT Judge (25point(s))

题目链接 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; struct user{ int id; int score[10];//每道题的得分 int totalscore; int perfectly_solve_num; ...

皮皮瓜的博客 119

PAT----A1075 PAT Judge (25point(s))

A1075 PAT Judge (25point(s)) 排序题 题意 输入学生提交记录,一次都没有通过编译器或者一次都没有提交的考试不出现在输出里面。注意输出的所有题目,如果该学生提交过了也应该输出0,即使没有通过编译,如果学生没有提交过该题目则输出 - 思路 之前没有注意到如果输出的学生提交过该题目该输出0而不是 -,看起来也不太好改,所有最后只能补救一下,用一个数组存一下没通过的,最后过滤了...

qq_43578870的博客 164

PAT_甲级_1075 PAT Judge (25point(s)) (C++)【结构体排序/成绩排名】

目录 1,题目描述 题目大意 2,思路 数据结构 算法 3,AC代码 4,测试结果 1,题目描述 Sample Input: 7 4 20 20 25 25 30 00002 2 12 00007 4 17 00005 1 19 00007 2 25 00005 1 20 00002 2 2 00005 1 15 00001 1 18 00004 3 25 000...

&再见萤火虫&的博客 275

1075 PAT Judge 的几点说明

刷题太多,容易忘掉自我…… 所以,这种题,一定要先把题目读明白了,比如,这里的学生id就指明了从00001开始。 然后这道题还有一个小问题: 数组默认是从0开始的,但是这里不管是学生id还是题目id都是从1开始的,所以,需要开辟一个大一号的数组。 原题如下 The ranklist of PAT is generated from the status list, which shows t...

AhaKnow 756

PAT(排序)——1075 PAT Judge (25 分)

1075 PAT Judge (25 分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specification...

WangXin Programmer 364

1075 PAT Judge (25 分)

1075PAT Judge(25分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specificati...

树叶子的博客 322

1075. PAT Judge (25)

The ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file contai...

weixin_30702887的博客 63

1075 PAT Judge (25 分)测试点4修正

#include <iostream> #include <cstdio> #include <string> #include <algorithm> #include <vector> using namespace std; const int maxn = 10010; const int maxpro = 6; //结构体...

qq_41755143的博客 1295

1075 PAT Judge (25分)【结构体排序】

1075PAT Judge(25分) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT. Input Specificatio...

胡小涛的博客 159
上一篇: 1044 Shopping in Mars (25 point(s))
下一篇: 1072 Gas Station (30 point(s))
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值