Codeforces Round #443 (Div. 2)

OpenWrt kmod内核不兼容?手把手教你用脚本强制安装驱动模块(附国内镜像源) 本文详细解决了OpenWrt kmod内核不兼容问题,提供智能脚本强制安装驱动模块的方法,并附有国内镜像源加速配置。通过自动化脚本修改内核MD5校验值,确保kmod包正常安装,同时推荐多个国内镜像源以提升下载速度。 阅读详情

A

比较傻用了二分

#include<bits/stdc++.h>

using namespace std;
#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)
#define pb push_back
const int qq = 1e7 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
int vis[qq];
int a[qq], b[qq];

int main() {
	int n;	scanf("%d", &n);
	mst(vis, 0);
	int start = -1;
	for(int i = 1; i <= n; ++i) {
		scanf("%d%d", a + i, b + i);
		if(start == -1) {
			start = a[i];
		} else {
			int l = 0, r = 1e6;
			int tmp;
			while(l <= r) {
				int mid = (l + r) >> 1;
				if(a[i] + mid * b[i] > start) {
					tmp = mid;
					r = mid - 1;
				} else {
					l = mid + 1;
				}
			}
			start = a[i] + tmp * b[i];
		}
	}
	printf("%d\n", start);
	return 0;
}


B

很显然当k>=n的时候肯定就是数列中数最大的那个数的人赢,其他情况模拟下即可

#include<bits/stdc++.h>

using namespace std;
#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)
#define pb push_back
const int qq = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;

int vis[505];
int a[505];
struct Node {
	int id, pw;
}p;

int main() {
	int n, k;	scanf("%d%d", &n, &k);
	int maxn = -1, id = -1;
	for(int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
		if(a[i] > maxn) {
			maxn = a[i];
			id = i;
		}
	}
	if(k > n) {
		printf("%d\n", maxn);
		return 0;
	}
	queue<Node> Q;
	if(a[2] > a[1]) {
		id = 2, maxn = a[2];
	} else {
		id = 1, maxn = a[1];
	}
	for(int i = 1; i <= n; ++i) {
		p.id = i, p.pw = a[i];
		if(id == i)	continue;
		Q.push(p);
	}
	while(true) {
		p = Q.front();
		Q.pop();
		if(maxn > p.pw) {
			vis[id]++;
			Q.push(p);
		} else {
			Node tmp;
			tmp.pw = maxn, tmp.id = id;
			Q.push(tmp);
			maxn = p.pw;
			id = p.id;
			vis[id]++;
		}
		if(vis[id] == k) {
			printf("%d\n", maxn);
			return 0;
		}
	}
}

C

我们知道如果进行 | 操作那么就可以确定某些位置肯定是1,如果进行 & 操作就可以确定某些位置肯定是0, 如果进行 ^ 操作如果是1的位置肯定是0,是0的位置肯定是1,未操作的位置可以覆盖 ^ 操作标记,如果本身已经被 ^ 操作覆盖那么这位重新变成未操作状态

#include<bits/stdc++.h>

using namespace std;
#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define pill pair<int, int>
const int qq = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
int bit[15];

int main() {
	mst(bit, -1);
	int n;	scanf("%d", &n);
	char op[6];
	int x;
	while(n--) {
		scanf("%s%d", op, &x);
		int cnt = 0;
		if(op[0] == '|') {
			while(x > 0) {
				if(x & 1)	bit[cnt] = 1;
				cnt++;
				x >>= 1;
			}
		} else if(op[0] == '&') {
			x = 1023 - x;
			while(x > 0) {
				if(x & 1)	bit[cnt] = 0;
				cnt++;
				x >>= 1;
			}
		} else {
			while(x > 0) {
				if(x & 1) {
					if(bit[cnt] == 1)	bit[cnt] = 0;
					else if(bit[cnt] == 0)	bit[cnt] = 1;
					else if(bit[cnt] == -1)	bit[cnt] = 2;
					else if(bit[cnt] == 2)	bit[cnt] = -1;
				}
				cnt++;
				x >>= 1;
			}
		}
	}
	int ans[3];
	ans[0] = 0, ans[1] = 1023, ans[2] = 0;
	for(int i = 0; i < 10; ++i) {
		if(bit[i] == 1)	ans[0] += (1 << i);
		else if(bit[i] == 0)	ans[1] -= (1 << i);
		else if(bit[i] == 2)	ans[2] += (1 << i);
	}
	printf("3\n| %d\n& %d\n^ %d\n", ans[0], ans[1], ans[2]);
	return 0;
}


D

题意:n个数字,讲这n个数字再重复m - 1次,删掉连续的k个相同的数,直到删除到不能再删为止,问最后剩下多少个数

思路:我们可以考虑相邻两个n个数字之间的删除情况,这两个确定了就可以确定之后的删除情况了,我们首先要预处理一下原本的n个数,也就是能删的就先删掉,具体看代码吧 能力有限

#include<bits/stdc++.h>

using namespace std;
#define LL long long
#define mst(a, b)	memset(a, b, sizeof a)
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define pill pair<LL, LL>
const int qq = 1e5 + 10;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 10;
LL n, k, m;
pill p[qq];

int main() {
	scanf("%lld%lld%lld", &n, &k, &m);
	int pre = -1;
	int top = 0, cnt = 0;
	p[0].fi = -1;
	for(int x, i = 0; i < n; ++i) {
		scanf("%d", &x);
		if(!top || p[top].fi != x) {
			p[++top].fi = x;
			p[top].se = 1;
		} else {
			p[top].se++;
		}
		if(p[top].se == k) {
			p[top--].se -= k;
		}
	}
	LL sum = 0;
	for(int i = 1; i <= top; ++i) {
		sum += p[i].se;
	}
	if(top == 0) {
		printf("0\n");
		return 0;
	}
	if(m == 1) {
		printf("%d\n", sum);
	} else if(k >= n) {
		if(top == 1) {
			printf("%lld\n", sum * m % k);
		} else {
			printf("%lld\n", sum * m);
		}
	} else if(k < n) {
		if(top == 1) {
			printf("%lld\n", sum * m % k);
		} else {
			int l = 1, r = top;
			LL d = 0, tmp = 0;
			while(l < r) {
				if(p[l].fi != p[r].fi)	break;
				if((p[l].se + p[r].se) % k == 0) {
					d += p[l].se + p[r].se;
					l++, r--;
				} else {
					d += (p[l].se + p[r].se) - (p[l].se + p[r].se) % k;
					break;
				}
			}
			LL ans = 0;
			if(l < r) {
				printf("%lld\n", sum * m - d * (m - 1));
			} else if(l == r) {
				if(p[l].se * m % k == 0) {
					ans = 0;
				} else {
					ans = sum * m - d * (m - 1) - (p[l].se * m / k * k);
				}
				printf("%lld\n", ans);
			}
		}	
	}
	return 0;
}


自动驾驶系统研发系列—全智能驾驶新高度:深入解析车道保持辅助(ELK)功能 车道保持辅助系统(ELK)是一种基于先进视觉感知技术的主动安全系统,能够通过车载摄像头实时监测道路上的车道线、道路边缘以及周围车辆的位置。这一功能的核心在于为驾驶员提供智能化的安全辅助,尤其是在驾驶员可能因疲劳、分心或其他原因无意识地偏离车道时,系统能够主动干预,从而避免危险发生。ELK系统不仅仅依靠摄像头对道路进行感知,还结合其他传感器的数据(如雷达),实时评估自车与车道线、周边车辆的相对位置。当系统检测到车辆即将偏离车道,或越过道路边缘时,ELK会通过控制电子助力转向系统(EPS) 阅读详情

相关推荐

智能体在车联网中的应用:第9天 核心工具链与仿真世界:SUMO交通仿真入门——从安装到构建你的第一个虚拟十字路口

摘要 SUMO是一款开源微观交通仿真工具,为车联网和自动驾驶算法开发提供高效安全的测试环境。文章详细介绍了SUMO的核心概念、安装方法及实战应用。在Ubuntu或Windows系统安装SUMO后,可通过netedit工具构建十字路口路网,包括创建节点、连接边、设置交通信号灯等步骤。随后通过编写.rou.xml文件定义车辆类型、路线和车流,实现动态交通场景模拟。SUMO支持与外部程序交互,能复现真实场景、进行极端测试和算法验证,是车联网研究的理想数字沙盘。

IT深耕十余载,大道之简 1474

Codeforces Round #443 (Div. 2) 题解

比赛链接:http://codeforces.com/contest/879 A. Borya's Diagnosis 题意:一个人去看医生,这n个医生分别在s[i],s[i]+2*d[i]...这些天上班,这个人必须按照顺序拜访医生,问这个人拜访最后一个医生的最早时间。 解法:按顺序模拟。 #include using namespace std; const int maxn = 1

I good vegetable a! 346

线阵相机标定必看:如何用Halcon实现亚毫米级精度测量(以HC050标定板为例)

本文以HC050标定板为例,详细阐述了如何利用Halcon实现线阵相机的高精度标定,以达到亚毫米级测量。文章深入剖析了线阵相机标定的核心原理、面临的独特挑战,并提供了从硬件搭建、图像采集到Halcon软件实操的完整路径,重点解析了运动参数设置、精度验证及常见问题排错,为精密测量应用提供系统解决方案。

weixin_29213655的博客 319

Codeforces Round #443 (Div. 2) A. Borya's Diagnosis(水水的模拟)

It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit docto

HJY 725

用Java实现森林冰火人游戏

g.drawString("游戏结束", CELL_SIZE * COLS / 2 - 100, CELL_SIZE * ROWS / 2);g.drawString("难度级别: " + difficultyLevel, 10, CELL_SIZE * ROWS + 60);g.drawString("生命值: " + playerHealth, 10, CELL_SIZE * ROWS + 20);setTitle("森林冰火人");

2401_82778412的博客 1738

winget安装提示:执行此命令时发生意外错误: InternetOpenUrl() failed. 0x80072efd

当我们使用Winget包管理器安装应用,提示错误:执行此命令时发生意外错误: InternetOpenUrl() failed. 0x80072efd 该怎么处理呢?请听我娓娓道来。

Linux I Tell U 8156

Codeforces #443 (div 2)

C. Short Programtime limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard outputPetya learned a new programming language CALPAS. A program in this language alwa

深藏不露是一种卓越的才能 304

高缺失率时空数据插补实战:从随机森林到扩散模型的性能对比

数据缺失是数据分析与机器学习建模中普遍面临的挑战,尤其在时空数据领域,传感器故障、传输中断等问题常导致数据不完整。数据插补技术旨在基于已知数据的模式和关联性,合理估算缺失值,为后续分析提供可靠基础。其核心原理在于利用数据的时空相关性(如时间周期性、空间邻近性)及与外部驱动因素(如交通、气象)的关联构建预测模型。这项技术的价值在于能将不完整的数据集转化为可用于高质量分析和预测的可用资产,广泛应用于环境监测、交通流量预测、金融风控等领域。本文聚焦于一个极具挑战性的场景——PM2.5监测数据缺失率高达82%,通过

weixin_30363285的博客 553

Codeforces Round #443 (Div. 2) D,E

看了题解发现做题的时候比较智障。D: 给一个长度为n的序列,每个序列有一个颜色aia_i,重复m次,一旦相同的颜色连续的长度大于k,这段就将被消除,求最终序列的长度。 Sol: First, let’s see what happens inside one bus. We can use a stack containing pairs (city, number of participa

DZYO的博客 532

保姆级图解:FD-SOI工艺流程中的关键三步(外延生长、应变硅、HKMG)

本文详细解析了FD-SOI工艺流程中的三大关键技术:外延生长、应变硅工程和HKMG集成。通过选择性外延生长技术优化接触电阻,利用应变硅提升载流子迁移率,并结合先栅高k金属栅工艺实现精准栅极控制,FD-SOI技术在智能手机处理器和自动驾驶芯片制造中展现出卓越的低功耗与高性能平衡。

weixin_29267307的博客 497

使用pytorch-superpoint与pytorch-superglue项目实现训练自己的数据集

superpoint与superglue的组合可以实现基于深度学习的图像配准,官方发布的superpoint与superglue模型均基于coco数据训练,与业务中的实际数据或许存在差距,为此实现基于开源的pytorch-superpoint与pytorch-superglue项目实现训练自己的数据集。然而,在训练pytorch-superpoint有诸多细节需要优化,特此整理成技术文档。本文档描述了实验pytorch-superpoint与pytorch-superglue项目训练自己的图像配准模型。

a486259的博客 9516

Codeforces Round #443 (Div. 2) B. Table Tennis

Codeforces Round #443 (Div. 2) B. Table Tennis 879B 啊啊啊啊啊啊 做的时候太天真了……一开始的直觉是对的……orz后来想多了,pretest还过了orz没想到啊orz,竟然wa了…… 一开始被k的大小迷惑了……根本就不用管呐,k>n的话,必然是序列中最大值的赢,k<n的话就循环判断谁的逆序数(或者逆序数+1)最先达到k ...

weixin_30354675的博客 72

【unity游戏开发入门到精通——UGUI】UI控件 —— Image图像控件

【unity游戏开发入门到精通——UGUI】UI控件 —— Image图像控件

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 2369

Codeforces Round #443 (Div. 2) 【A、B、C、D】

Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis【水题】 1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 using namespace std; 5 in...

dhe56357的博客 148

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Codeforces Round #443 (Div. 2) A-C 题解

A. Borya's Diagnosis time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the

Ever_glow的博客 826

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Codeforces Round #443 (Div. 2)BTable Tennis

n个人排队打乒乓球,首先一个人站在擂台上跟他之后的人打,如果能连续打败k个人就可以获胜,每次对战败的人站到队伍最后,获胜的人在擂台,每个人都有相应的已知战力值,战力高的可以打败战力低的,输出获胜的人的战力

AC__GO的博客 369

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

Codeforces Round #443(div 2)

A题,他要去见n个医生,每个医生都有一个特殊的工作时间表,在si天开始工作,每个di天工作。他在最后一个医生那里拿到他的病情表。问最快能拿到病情表是那一天。 因为范围比较小,所以直接暴力就行。 代码如下:#include<iostream> #include<cstring> #include<string> #include<set> #include<cmath> #include<vect

henuzxy 275

【Codeforces Round #443 (Div. 2) B】Table Tennis

【链接】 我是链接,点我呀:) 【题意】 n个人站在一排。 每次第一个人和第二个人打架。 输的人跑到队列的尾巴去。 然后赢的人继续在队首.和第三个人打。 谁会先赢K次。 【题解】 会发现,一轮之后就一直是那个最大的赢了。 则第一轮先模拟,有人达到k次就直接输出它。 否则输出那个最大的就好。 【代码】 #include <bits/stdc++.h> #de...

AWCXV 102

Codeforces Round #443 (Div. 2) 总结

这场终于渡劫成功233..冲上了紫名。 20场的艰苦奋斗2333…(虽然这场又fst了B,但我又hack了10个人..把Bfst掉的分补了回来,所以还能保住前200,就上紫了..这场也暴露了一个我的不足:我在写完ABC后觉得D不可做,就去检查前面的题,后来发现B题有漏洞,就改完兴奋地锁掉了然后想去插人,结果……lock完发现自己没改完全,还是会WA..就GG了……所以以后我检查时一定要

Ephemeral 304

Codeforces Round #443 (Div. 2) A. Borya's Diagnosis

病人去看医生,医生的上班规律是,第s天上班之后每d天上一次班,问最后一次看医生是第几天。病人看医生也有要求,要求看医生需要按顺序看,也就是,看完第一个医生才能看下一个医生

AC__GO的博客 442

【Codeforces Round #443 (Div. 2) C】Short Program

【链接】 我是链接,点我呀:) 【题意】 给你一个n行的只和位运算有关的程序。 让你写一个不超过5行的等价程序。 使得对于每个输入,它们的输出都是一样的。 【题解】 先假设x=1023,y=0; 即每位都是1和每位都是0; 然后做一下这n个操作。 得出,每一位如果是0的话输出应该是几,以及每一位是1的话输出应该是几. 会发现,用or和xor和and就能完成. 【代码】...

166

【Codeforces Round #443 (Div. 2) A】Borya's Diagnosis

【链接】 我是链接,点我呀:) 【题意】 在这里输入题意 【题解】 模拟 【代码】 #include <bits/stdc++.h> using namespace std; const int N = 1000; int n; pair <int,int> a[N+10]; int main(){ // freopen("rush....

95
上一篇: Codeforces Round #442 (Div. 2)
下一篇: Educational Codeforces Round 31
Yokile_
博客等级 码龄11年 37粉丝 245原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值