Codeforces Round #327 (Div. 2) (591A,591B,590A(找规律),590B(二分))

基于深度学习的道路裂缝检测识别研究(开题报告) 具体而言,将本研究提出的模型与其他先进的道路裂缝检测算法在相同的数据集上进行对比实验,通过对比实验结果,分析不同算法在准确率、召回率、F1值等指标上的优劣,以及在实际应用中的表现。通过对综述论文的学习了解,对计算机视觉、多模态相关领域的基础进行简要介绍,并在跨模态行人重识别研究领域归纳国内外研究现状和发展趋势,明确当前面临的问题和挑战,并针对当前存在的问题展开后续研究。第二,研究解决该问题的途径和方法。基于深度学习的道路裂缝检测识别研究,旨在通过构建和优化深度学习模型,实现对道路裂缝的自动识别和定位。 阅读详情

Wizards' Duel

题目链接:

http://codeforces.com/problemset/problem/591/A

解题思路:

Let's start with determining the position of the first collision. Two impulses converge with a speed p + q, so the first collision will occur after  seconds. The coordinate of this collision is given by the formula .

Note, that the distance one impulse passes while returning to it's caster is equal to the distance it has passed from the caster to the first collision. That means impulses will reach their casters simultaneously, and the situation will be identic to the beginning of the duel. Hence, the second collision (third, fourth, etc) will occur at exactly the same place as the first one.

题目大意:

把问题简化成为:两物体相向而行,问相遇的地点(相对于第一个物体而言)。

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

int main(){
    double l,p,q;
    while(~scanf("%lf%lf%lf",&l,&p,&q)){
        printf("%.4lf\n",l/(p+q)*p);
    }
    return 0;
}

Rebranding

题目链接:

http://codeforces.com/problemset/problem/590/B

解题思路:

Trivial solution will just emulate the work of all designers, every time considering all characters of the string one by one and replacing all xiwith yi and vice versa. This will work in O(n·m) and get TL.

First one should note that same characters always end as a same characters, meaning the position of the letter doesn't affect the result in any way. One should only remember the mapping for all distinct characters. Let p(i, c) be the mapping of c after i designers already finished their job. Now:

  • p(0, c) = c
  • If p(i - 1, c) = xi, then p(i, c) = yi
  • Same, if p(i - 1, c) = yi, then p(i, c) = xi

This solution complexity is O(|Σ|·m + n) and is enough to pass all the tests.

Challenge: improve the complexity to O(Σ + n + m).

题目大意:

输入n和m, 然后再输入n个字母。再给你m个替换操作,输出替换后的字符串。 

算法思想:

不能直接操作,考虑到英文小写英文字母最多只有26个,直接对26个英文字母进行替换操作,然后再带进去即可。 

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

char str[200005],change[30];

int main(){
    int n,m;
    while(~scanf("%d%d",&n,&m)){
        scanf("%s",str);
        char x,y,tmp;
        for(int i = 0; i < 26; i++)
            change[i] = i+'a';
        for(int i = 0; i < m; i++){
            getchar();
            scanf("%c%c%c",&x,&tmp,&y);
            for(int j = 0; j < 26; j++){
                if(change[j] == x)
                    change[j] = y;
                else if(change[j] == y)
                    change[j] = x;
            }
        }
        for(int i = 0; i < n; i++)
            str[i] = change[str[i]-'a'];
        printf("%s\n",str);
    }
    return 0;
}

Median Smoothing(找规律)

题目链接:

http://codeforces.com/problemset/problem/590/A

解题思路:

We will call the element of a sequence stable, if it doesn't change after applying the algorithm of median smoothing for any number of times. Both ends are stable by the definition of the median smoothing. Also, it is easy to notice, that two equal consecutive elements are both stable.

Now we should take a look at how do stable elements affect their neighbors. Suppose ai - 1 = ai, meaning i - 1 and i are stable. Additionaly assume, that ai + 1 is not a stable element, hence ai + 1 ≠ ai and ai + 1 ≠ ai + 2. Keeping in mind that only 0 and 1 values are possible, we conclude that ai = ai + 2 and applying a median smoothing algorithm to this sequence will result in ai = ai + 1. That means, if there is a stable element in position i, both i + 1 and i - 1 are guaranteed to be stable after one application of median smoothing. Now we can conclude, that all sequences will turn to stable at some point.

Note, that if there are two stable elements i and j with no other stable elements located between them, the sequence of elements between them is alternating, i.e. ak = (ai + k - i)mod2, where . One can check, that stable elements may occur only at the ends of the alternating sequence, meaning the sequence will remain alternating until it will be killed by effect spreading from ending stable elements.

The solution is: calculate max(min(|i - sj|)), where sj are the initial stable elements. Time complexity is O(n).

Challenge 1: hack the solution that just applies median smoothing until something changes.

Challenge 2: think of how to speed up the algorithm from challenge 1 using bitmasks (still gets TL).

题目大意:

给你了一段 0 1 组成的波,然后这个波的值可能会发生变化,不计起点和终点,如果某一位置上的值不等于其左右位置加上自己的中位数话,那么它会变成中位数,这样导致波会振荡一次,问波最终是否会稳定,不会输出-1。会,就输出其振荡次数与最终波的值。

算法思想:

首先可以判断最终波是一定会稳定的,不可能最终不稳定。因为只有0与1,边缘值a1与an不变了,所以他们只会往中间延伸这种稳定的状态。然后确定只要连着两个00 或者11 就不会改变,改变的只会是01交替出现的。然后不断更新即可。

AC代码:

#include<bits/stdc++.h>
using namespace std;

const int maxn = 505050;
int n;
int arr[maxn];

int modify(int l, int r){
    if(l == r)
        return 0;
    if(arr[l] == arr[r]){
        for(int i = l+1; i < r; i++)
            arr[i] = arr[l];
        return (r-l)/2;
    }
    else{
        int m = (l+r+1)/2;
        for(int i = l+1; i < m; i++)
            arr[i] = arr[l];
        for(int i = m; i < r; i++)
            arr[i] = arr[r];
        return (r-l-1)/2;
    }
}

int main(){
    while(~scanf("%d",&n)){
        for(int i = 0; i < n; i++)
            scanf("%d",&arr[i]);
                int ans = 0;
        int l = 0;
        for(int i = 0; i < n; i++){
            if(i == n-1 || arr[i] == arr[i+1]){
                ans = max(ans, modify(l, i));
                l  = i+1;
            }
        }
        printf("%d\n",ans);
        for(int i = 0; i < n-1; i++)
            printf("%d ",arr[i]);
        printf("%d\n",arr[n-1]);
    }
    return 0;
}

Chip 'n Dale Rescue Rangers(二分)

题目链接:

http://codeforces.com/problemset/problem/590/B

解题思路:

If the velocity of the dirigible relative to the air is given by the vector (ax, ay), while the velocity of the wind is (bx, by), the resulting velocity of the dirigible relative to the plane is (ax + bx, ay + by).

The main idea here is that the answer function is monotonous. If the dirigible is able to reach to target in  seconds, then it can do so in  seconds, for any x ≥ 0. That is an obvious consequence from the fact the maximum self speed of the dirigible is strictly greater then the speed of the wind at any moment of time.

For any monotonous function we can use binary search. Now we only need to check, if for some given value  it's possible for the dirigible to reach the target in  seconds. Let's separate the movement of the air and the movement of the dirigible in the air. The movement cause by the air is:

  • (xn, yn) = , if ;
  • (xn, yn) = , for .

The only thing we need to check now is that the distance between the point (xn, yn) and the target coordinates (x2, y2) can be covered moving with the speed vmax in  seconds assuming there is no wind.

Time complexity is , where C stands for the maximum coordinate, аnd ε — desired accuracy.

Challenge 1: think of the solution in case it's not guaranteed that the dirigible is faster than the wind.

Challenge 2: can you come up with O(1) solution?

物理问题,求飞船从一点到另一点的距离,有风速的影响。

orz,我当时怎么没想到呢,这题居然用二分,把飞船和风分开考虑,不然不断二分求解。太好了。

AC代码:

#include <bits/stdc++.h>
using namespace std;

int main(){
    double x1,y1,x2,y2,vmax,t,vx,vy,wx,wy;
    while(~scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2)){
        scanf("%lf%lf",&vmax,&t);
        scanf("%lf%lf%lf%lf",&vx,&vy,&wx,&wy);
        double l = 0, r = 1e9;
        for(int i = 0; i < 100; i++){
            double mid = (l+r)/2;
            double x = x1 + min(mid, t) * vx + max(mid - t, 0.0) * wx;
            double y = y1 + min(mid, t) * vy + max(mid - t, 0.0) * wy;
            (hypot(x - x2, y - y2) > vmax * mid ? l : r) = mid;
            //hypot计算直角三角形的斜边长
        }
        printf("%.6lf\n",l);
    }
    return 0;
}



rag综述——RAG技术发展流程、最新技术挑战与系统级优化 RAG技术发展综述:本文系统梳理了检索增强生成(RAG)技术的演进历程,从2017年开放域问答中的早期探索,到2020年正式提出RAG架构并与大模型深度融合,再到2025年向系统化、可信化和智能体化发展。当前RAG面临检索可靠性、系统效率和生成可信度三大核心挑战,解决方案包括领域自适应训练、强化语义编码、迭代检索策略等优化方向。未来RAG将向GraphRAG、SafeRAG等方向发展,从单纯性能优化转向构建可控、可审计的语言系统框架,成为高可靠大模型应用的基础设施。 阅读详情

相关推荐

LayaBox CommandBuffer描边使用详细

项目需要使用LayaBox做一个给3D物体动态描边的一个功能,前前后后踩了一些坑算是把这个东西给做出来了把我改好的代码贴上,分享给大家。 (1)想要使用描边你的引擎版本必须 >=2.9.0 (2)你必须下载 Laya官方的BlurShader库才能使用这个功能,下载地址:https://github.com/layabox/layaair-demo/tree/master/h5/3d/ts/LayaAir3D_PostProcess/BlurShader 下载完之后把BlurShader放到自己项目的

小智队长 1733

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1)C. Save the Nature

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1)C. Save the Nature 题意:一批商品,位置为a的倍数和b的倍数可以获利,问最少几个商品出售可以获利k 做法:对答案二分,即需要多少个上可以达到k,对这种情况下进行最优check 为什么每次二分都想不到二分。。。。 #include&l...

想要一只银渐层 356

使用Docker搭建MaxKB智能体平台

【代码】使用Docker搭建MaxKB智能体平台。

janthinasnail的博客 708

Simulink电感矩阵奇异值报错:从原理到排查的工程实践指南

在电力系统电磁暂态仿真中,电感矩阵是描述电路网络电感与互感关系的核心数学工具,其本质源于基尔霍夫定律和电磁感应原理。一个非奇异的电感矩阵是电路状态可被唯一求解、仿真得以稳定运行的基础,这直接关系到模型的物理正确性与数值稳定性。当矩阵出现奇异或病态时,往往意味着模型存在违反物理定律的拓扑或参数设置,例如形成了纯电感回路或互感参数不满足可实现条件,导致仿真初始化失败。这类问题在包含复杂电机、变压器及电力电子开关的并网系统(如风电场)仿真中尤为常见。本文聚焦于Simulink/Simscape Electrica

weixin_33904756的博客 445

三维荧光光谱(EEM)散射干扰实战:从识别到精准切除的完整流程

本文详细解析三维荧光光谱(EEM)中散射干扰的识别与精准切除流程,涵盖瑞利散射和拉曼散射的实战处理技巧。通过drEEM工具箱的应用示例和高级场景解决方案,帮助研究者有效消除散射干扰,提升数据准确性,特别适用于环境样品和生物活体样本分析。

weixin_42554042的博客 327

【语音识别】基于MFCC特征实现说话人语音识别matlab源码

1 模型 采用能够反映人对语音的感知特性的Mel频率倒谱系数(MFCC)作为特征参数,以及为避免时间规整问题采用矢量量化技术开发的说话人识别系统.MFCC主要的是模拟人耳的听觉过程,相对于其它参数它对语音波形的变化不敏感,更加稳定,系统取得很好的识别结果,实验表明系统训练和识别的计算量和存储量都比较低. 2 部分代码 functionvarargout=Main(varargin) % MAIN M-file for Main.fig % MAIN, by itself...

qq_59747472的博客 848

Codeforces Round #591 Div. 2

1223A CME 题意:给定一个数0≤n≤1e90 \le n \le 1e90≤n≤1e9,把它分成三个数a,b,c使得a + b = c。问至少要增加多少才能分? 题解: 当n==2时,至少需要2。因为最小的等式是1+1=2。 当n>2分两种情况 ,n为偶数时,令c=n/2,a=⌊n/2⌋,b=⌈n/2⌉c = n/2, a = \lfloor n / 2 \rfloor,b = \l...

kdh的专栏 516

面向业务角色的 SAP Fiori Space 与 Page 创建全流程实战指南

业务角色导航设计:从Space与Page规划到实施 摘要:本文探讨了SAP S/4HANA Cloud和BTP ABAP环境中基于业务角色的导航设计方法。传统Fiori Launchpad的Group+Tile模式存在应用堆积问题,而新的Space与Page模型将导航按工作领域(如应付会计、销售代表)组织,每个Space包含多个任务导向的Page。文章详细介绍了从业务角色建模到Space/Page创建、分配的完整流程,包括核心概念解析、规划思路和具体操作步骤。重点阐述了如何根据业务需求选择创建方式(基于预交

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 183

Codeforces Round #591 (Div. 2)

A. CME 题目链接:https://codeforces.com/contest/1241/problem/A 题意: 你有 N 根火柴 , 多少根火柴就可以组成多大的数(如 三根火柴可以表示 3), 现在要求你用火柴组成任意三个数 A , B , C 使得 A + B = C 关系成立 如果无论怎么组都无法使等式成立 , 则你可以额外购入 X 根火柴来重新组数使得关系成立 , 求 X 的...

qq_38227632的博客 99

【DaVinci Developer专题】-36-创建一个“既读又写”的Sender Receiver Port(SR PR-Port)

有时会遇到SWC需要对一个Port进行“既可以读,也可以写”的操作。以下图为例,Test_A_SWC中Test_A_Port是P-Port;Test_B_SWC中Test_A_Port是R-Port。Test_C_SWC需要对Test_A_Port同时进行“读”和“写”。 该篇将详细介绍PR-Port的创建方法。 目录 1 创建一个S/R Port Interface 2 将一个PR-Port端口添加至Application Component 3 PR-Port端口初始化 4 Run.

「汽车电子助手」的博客 3013

C# Blazor Server工业监控Web UI:实时数据推送、历史曲线、报警记录,跨浏览器访问(踩坑总结+生产可用)

坑点现象解决方案StateHasChanged()太频繁服务器CPU占用高,浏览器卡顿别100ms刷新一次,1秒刷新一次足够并发高时服务器卡多个用户同时访问,服务器响应慢用Redis做分布式缓存,或者加服务器做负载均衡断线重连后数据丢失浏览器刷新后,实时数据不更新用InfluxDB存历史数据,刷新后重新查询工业现场网络不稳定Blazor Server频繁断线用SQLite本地缓存,断网时数据不丢,联网后补发历史曲线查询慢查询过去7天的数据,要等很久。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 305

Codeforces Round #327 (Div. 2) 591ABC题解

题目链接:点击打开链接 A: 两个人在两端相向而行, 第一次碰面后掉头, 到端点后又掉头, 问第二次碰面时候距离左端点的距离. 脑洞题目, 第二次和第一次碰面在同一个地方, 要求精度在1e-4以内, 输出5位小数即可. AC代码: #include "iostream" #include "cstdio" #include "cstring" #include "algorithm

GKHack's Blog 1122

xtop:multi_driven_net与incomplete_timing_cell fail reason 分析

man multi_driven_net”可以得知,这个问题是multi driven结构引起的,使用命令“get_failed_pins -reason multi_driven_net”,获取violation pin。“man incomplete_timing_cell”可以得知,这个fail reason的原因是缺少timing library cell,检查并补全后这个错误就显示了。这里选择的解决方法是修改lib文件,把inout改成input,重新lib2idb。通过这种方法解决了问题。

m0_61544122的博客 566

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1)

打cf的过程中遭受到了DDOS攻击,导致最终无法进行下去,也算是奇闻一件了 A. CME 思路:看似像个火柴游戏,实则只是个判断奇偶的水题 /* Author Owen_Q */ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e7+5; i...

Owen_Q的博客 447

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

Codeforces Round #691 (Div. 2)

文章目录A. Red-Blue ShuffleB. Move and TurnC. Row GCD A. Red-Blue Shuffle 题目 There are n cards numbered 1,…,n. The card i has a red digit ri and a blue digit bi written on it. We arrange all n cards in random order from left to right, with all permutations of

一只小蒟蒻的博客 1510

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

【CF】Day28——Codeforces Round 591 (Div. 2, based on Technocup 2020 Elimination Round 1) C

典还是一道很简单的题的,我们可以观察到一个显然的贪心,我们肯定是要把大的数放在收益多的位置,同时题目不需要我们输出位置什么的,所以我们直接将原数组降序排序,然后计算即可我们可以利用二分答案,每次二分选 mid 张票,然后check一下行不行具体看代码。

qq_61422664的博客 222

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Codeforces Round #327 (Div. 2) C. Median Smoothing 找规律

http://codeforces.com/problemset/problem/591/C 这道题的原意是对一个数组进行中值滤波,也就是让一个数等于自己,左边右边的中位数。问什么时候数组不再发生变化。 首先,如果一个数组不发生变化,我们很容易想到这样的数组中每个数至少和左边或者右边相等。那么只有01交替的数组才会发生变化。 那么我们写几个数组在实验一下 010101 —-&gt; 000...

limn204的专栏 184

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) B

https://codeforces.com/contest/1241/problem/B #include <bits/stdc++.h> using namespace std; #define LL long long #define LD long double #define SC(t,x) static_cast<t>(x) #define AR(t) ve...

king9666的博客 161

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) 题解

A..B略 C 对当前的值排序,再二分答案,然后对于(i%x==0 && i%y==0)放入大的,再放其他的贪心解决即可。 #include<iostream> #include<stdio.h> #include<string.h> #include<algorithm> #include<map&g...

qq_40921866的博客 232

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) C. Save the Nature(二分)

题目链接:https://codeforces.com/contest/1241/problem/C 思路:题目的答案具有单调性,(如果3是答案的话,小于3的数都不是答案),所以可以二分,直接二分位置即可,因为要满足res >= k 的最小答案,所以位置一定是%a,或者%b ,或者%(a + b)为 0的位置,然后对每个位置采用贪心的思路,让最大的数字*最大的倍率。 代码: #include...

一只谜谜怪的博客 164

Codeforces 591 B Rebranding【Codeforces Round #327 (Div. 2)】

B. Rebranding time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The name of one small but proud corporation consists of

代码改变世界 821

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1)补题

文章目录A - CMEB - Strings EqualizationC - Save the NatureD - Sequence SortingE - Paint the Tree 题目 A - CME #include<bits/stdc++.h> using namespace std; int main(){ int q; scanf("%d",&q); while(...

qq_44290978的博客 577

Codeforces Round #591 (Div. 2)D. Sequence Sorting(思路)

题目链接: https://codeforces.com/problemset/problem/1223/D 题面: 题意: 一次操作可以把一种数字(不一定是只有一个)移动到最左边或最右边,问最少经过几次操作可以使序列变成不下降序列。 ps:没初始化wawawa了,数组开小了rerere,我sb了orz。orz。orz。 思路: 考虑不需要移动的(也就是本身连续不减)数,这里用邻接表的形式存某...

nuoyanli的博客 1635

Codeforces Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) A

https://codeforces.com/contest/1241/problem/A #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int q,n;...

king9666的博客 259

Codeforces Round #591 (Div. 1)A.Save the Nature

Wrong answer on test2 15ms 0KB 感觉思路上就有问题,把问题搞复杂了?心态爆炸。。。心情好了再改???? #include <iostream> #include <vector> #include <cstring> #include <string> #include <map&...

YGLeeeon的博客 342

Codeforces Round #591 (Div. 1, based on Technocup 2020 Elimination Round 1)

A.Save the Nature: 题意: 你是一名售票员,有N张票待售,需要你通过决定售票的顺序来使你的抽成最多。 称售票的次序为“名次”。名次仅为a的倍数,可以抽成x%;名次仅为b的倍数,可以抽成y%;名次既为a的倍数又为b的倍数,可以抽成(x + y)%。 ...

Masker 296
上一篇: Codeforces Round #259(454A,454B,453A(排列组合))
下一篇: BestCoder Round #61 (div.2)(hdu5522,hdu5523,hdu5524,hdu5525(数论:费马小定理))
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值