Codeforces Round 935 (Div. 3)A~E

ComfyUI实战:AnimateDiff与ControlNet结合,打造无缝风格化视频转绘 本文详细介绍了如何利用ComfyUI平台,结合AnimateDiff与ControlNet插件,实现高质量的视频风格化转绘。通过搭建节点工作流、调整关键参数,有效解决画面闪烁与失真问题,并分享了进阶玩法与常见问题解决方案,帮助用户轻松打造流畅、风格统一的动态视觉效果。 阅读详情
A. Setting up Camp

题目分析:

 有三种人,内向、外向、综合,内向必须独自一个帐篷,外向必须3个人一个帐篷,综合介于1~3人一个帐篷,我们发现非法情况只会存在外向的人凑不成3个人一个帐篷的情况,因外向不够可以向综合人借,故将二者合并并判断:

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 1e18
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin()+1,a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n' 
#define safe_map unordered_map<int, int, custom_hash>
using namespace std;
typedef pair<int,int>pii;
const int N =2e5+7;
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
signed main()
{IOS
    use{
        int a,b,c;cin>>a>>b>>c;
        int x=b%3;
        if(x+c<3&&x!=0)cout<<"-1"<<endl;// 非法情况
        else cout<<a+(b+c)/3+((b+c)%3?1:0)<<endl;//else
    }
return 0;
}
B. Fireworks

题目分析:

A类烟花每a分钟发射一次,B类烟花每b分钟发射一次,它们都能持续m分钟,那么我们直接用m分别求出这两类烟花都能放几个加和即可,注意, 我们可以选择烟花发射时间包含二者最小公倍数所以最终结果+2

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 1e18
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin()+1,a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n' 
#define safe_map unordered_map<int, int, custom_hash>
using namespace std;
typedef pair<int,int>pii;
const int N =2e5+7;
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
signed main()
{IOS
    use{
        int a,b,m;cin>>a>>b>>m;
        cout<<m/a+m/b+2<<endl;
    }
 
return 0;
}
C. Left and Right Houses 

题目分析:

给定字符串s,要求将字符串分隔,并且确保满足题目条件,遍历即可

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 1e18
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin()+1,a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n' 
#define safe_map unordered_map<int, int, custom_hash>
using namespace std;
typedef pair<int,int>pii;
const int N =2e5+7;
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
char s[3000005];
int s1[300005];
signed main()
{
use{
	int n;cin>>n;
		scanf("%s",s+1);
		for(int i=1;i<=n;i++)s1[i]=s1[i-1]+(s[i]-48);
		int ans=-1;
		for(int i=0;i<=n;i++)if(s1[i]<=i-s1[i] && s1[n]-s1[i]>=(n-i)-(s1[n]-s1[i])){
			if(abs(n-i-i)<abs(n-ans-ans))ans=i;
		}
		cout<<ans<<endl;
}
 


return 0;
}

D. Seraphim the Owl 

题目分析:

当主人公在i位置时,他想要换到j位置,首先需要花费 a[j] 元, 并且需要花费 \sum_{x=i-1}^{j-1}p_x

因为主人公需要至少排在第m位,所以在n+1~m-1之间我们可以选择最优值,也就是min(a[i],b[i]),

到m后,我们可以选择a[m]来停下,但是考虑到有可能到前面的位置花费会更小所以我们再向前模拟,更新最小值

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 1e18
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin()+1,a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n' 
#define safe_map unordered_map<int, int, custom_hash>
using namespace std;
typedef pair<int,int>pii;
const int N =2e5+7;
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
signed main()
{IOS
   use{
    int n,m;cin>>n>>m;
    vct<int>a(n+1),b(n+1);
    for(int i=1;i<=n;i++)cin>>a[i];
    for(int i=1;i<=n;i++)cin>>b[i];
    int ans=0;
    for(int i=n;i>m;i--){
        ans+=min(a[i],b[i]);
    }
    int mins=a[m];
    int x=0;
    for(int i=m;i>1;i--){
        x+=b[i];
        mmin(mins,x+a[i-1]);
    }
    cout<<ans+mins<<'\n';

     
   }

 


return 0;
}

E. Binary Search

 

题目分析:

二分但没完全二分,数组的取值为1~n,且可能不单调,题目给出的方法适用于单调递增,故,如果起初数组为单调递增的话操作数为0,否则,我们按照题意进行二分模拟,最终二分出来的坐标l 与x起初的位置换一次即可;

证明可行性,因在原数组模拟的情况下,在过程中l满足小于等于x的性质,x也同样满足小于等于x的性质,故可等价替换,故仅需要一次操作即可二分得到x

#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define INF 1e18
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define int long long
#define pb push_back
#define vct vector
#define checkbit __builtin_popcount
#define gcd __gcd
#define use int T;cin>>T;while(T--)
#define LEN length()
#define all(a) a.begin()+1,a.end()
template<class T> bool mmax(T &u, T v) { return u < v ? (u = v, 1) : 0; }
template<class T> bool mmin(T &u, T v) { return u > v ? (u = v, 1) : 0; }
#define lowbit(x) (x&(-x))
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n' 
#define safe_map unordered_map<int, int, custom_hash>
using namespace std;
typedef pair<int,int>pii;
const int N =2e5+7;
struct custom_hash {
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
x ^= FIXED_RANDOM;
return x ^ (x >> 16);
}
};
signed main()
{IOS
    use{
        int n,x;cin>>n>>x;
        vct<int>a(n+1);
        int cnt=0;
        safe_map mp;
        for(int i=1;i<=n;i++){
            cin>>a[i];
            mp[a[i]]=i;
        }
        if(is_sorted(all(a)))cout<<"0"<<endl;
        else {
            cout<<"1"<<endl;
           int l=1,r=n+1;
           while(l<r-1){
            int mid =(l+r)>>1;
            if(a[mid]>x)r=mid;
            else l=mid;
           }
           cout<<l<<" "<<mp[x]<<endl;
        }
        
    }
 


return 0;
}

 总结:A~E题都可以用模拟or 思维解出.

 

 

基于Transformer的股票市场多因子量化选股模型,深度解析:基于Transformer的股票市场多因子量化选股模型 传统多因子模型通常采用线性回归、岭回归或Lasso回归来估计因子权重,其核心假设是因子与未来收益之间存在线性关系。然而,现实中的股票市场具有典型的非线性、非平稳和高噪声特征。卷积神经网络(CNN)擅长提取局部特征,但难以捕捉全市场股票之间的全局依赖关系;循环神经网络(RNN)及其变体LSTM虽然能处理时间序列,但存在梯度消失问题且难以并行计算。Transformer的self-attention机制能够:直接建模任意两只股票之间的相关性动态计算因子权重而非静态线性组合。 阅读详情

相关推荐

android6 usb默认文件管理,不弹RSA配对提示框

本文修改针对 高通 Android6.0.1 出user版本时 https://www.cnblogs.com/Jokeyyu/p/7424262.html http://blog.csdn.net/sinc00/article/details/44957943 diff --git a/frameworks/base/packages/SystemUI/src/com/android...

木叶风的博客 693

算法第一次作业(2.帐篷问题)

题目: 某公司团建郊游,男女生一共有T个人,其中X个为男生, Y个为女生,再其中,有v对异性情侣,到宿营地后,开始分配帐篷。 帐蓬有三种,三人帐篷,普通双人帐篷和爱心帐篷。 注意,普通帐篷双人和三人帐蓬都只能住相同性别的人,而爱心帐篷可以住一对异性情侣。但是,普通帐篷和三人帐篷的实际入住人数量可以小于其上限,而爱心帐篷则不行。 帐蓬价格:三人帐篷p1元/顶,普通双人帐蓬p2元/顶,爱心帐篷p3元/顶 要求总价最少即可。注:三人帐篷不一定比两人帐篷便宜。情侣可以拆开睡。 #include<iostrea

qq_50881381的博客 780

Linux下OpenFire+Spark即时通讯环境搭建全攻略(含证书错误解决方案)

本文提供了一份详尽的Linux环境下OpenFire服务器与Spark客户端即时通讯系统的搭建与配置全攻略。内容涵盖从环境规划、服务端部署、数据库配置到客户端连接的全流程,并重点解决了Spark连接时常见的证书验证错误问题,为企业构建私有化、高可用的XMPP通讯平台提供了实战指导。

weixin_29251131的博客 168

L2-017 人以群分 (25 分)(c语言实现)

该题目如下 如题所示,其中会先给数据的个数,所以先进行数据的录入,利用数组来存储数据中的活跃度,同时利用一个n来记录数组中元素的个数。 数据录入过程: int n1, n2, n3; int n = 0; scanf("%d", &n); int arr[100000]; for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } 排序在这里选用库函数自带的qsort,否则不能达到该题所要求的时间要求(测试点四),手打快排

weixin_63291917的博客 2169

从零部署思澈科技SiFli-Solution:避坑指南与实战排错

本文详细介绍了从零部署思澈科技SiFli-Solution开发环境的完整流程与实战排错指南。重点解析了Keil uVision5版本选择、Butterfli工具路径配置等关键步骤,并针对Keil路径报错、函数冲突等高频问题提供了具体解决方案,帮助开发者高效避坑,快速搭建稳定的嵌入式开发环境。

devops8pract的博客 532

基于Q-learning的无人机三维路径规划(含完整C++代码)

基于Q-learning的无人机三维路径规划(含完整C++代码)

weixin_54186646的博客 1万+

【Codeforces Round 935 (Div. 3) A~E (Go语言题解)】

题目:组委会计划在游览结束后带领奥林匹克运动会的参赛选手进行徒步旅行。目前,正在计算需要搭乘的帐篷数量。据了解,每个帐篷最多可容纳3人。在参赛选手中,有a名内向型选手,b名外向型选手和c组委会非常尊重每位参赛者的意愿,因此他们希望满足所有参赛者的愿望。请告诉我们至少需要多少顶帐篷,以便所有参加者都能根据自己的喜好找到住处。如果无法满足所有参与者的愿望,则输出−1。题解 :判断3 - b % 3 是否大于c如果大于则不可能安排,其余结果都是可行的最小的即为下面代码所示,时间复杂度O1。

123_wby的博客 2085

ESP32-S3 + TB6600驱动42步进电机:从基础接线到AccelStepper库平滑加减速实战

本文详细介绍了如何使用ESP32-S3开发板和TB6600驱动器控制42步进电机,从基础接线到利用AccelStepper库实现平滑加减速控制。内容涵盖硬件连接、基础驱动代码、AccelStepper库的安装与参数调优,以及高级技巧与故障排除,帮助创客实现工业级精准控制。

weixin_42632434的博客 290

Codeforces Round 935 (Div. 3)(A~E)

Codeforces Round 935 (Div. 3)(A~E)

qq_17807067的博客 1312

excel wind插件使用_Python和wind的交互—在债券中的应用

个人认为学会了怎么用python和wind交互以及怎么用python处理Excel数据,就基本能替换日常很多琐碎的债券工作,还不用担心Excel某个值改变了导致整个报表都毁了。事实上在python调用wind函数和在Excel中调用函数一样简单,只要会基本的操作就够了。下面详细的介绍如何用python和wind进行交互。首先安装好python+pycharm+wind。因为python...

weixin_39863918的博客 5332

SAP_ABAP_MM_BAPI清单案例教程——采购发票校验/预制_BAPI_INCOMINGINVOICE_PARK_MIRO

SAP ABAP BAPI_INCOMINGINVOICE_PARK BAPI 采购发票预制 采购发票校验 代码模版

java_zhong1990的专栏 1967

Codeforces Round #935 (Div. 3)(A~E)python

每个烟花会持续一个区间,不限时间,所有情况都可能在某一时刻出现,为了使一个区间每种烟花有更多个,可以出现n/a上取整个烟花,即区间开始有之前持续中的烟花,若可以整除,可以强行错一下位,使后面的烟花也在m时间内出现。暴力枚举每个位置,记录左边0的个数和右面1的个数,只有当左边的个数超过左边现有村庄的一半时,才可取答案,取其中离中心较小的一个,距离相同取左边,当n为奇数时,中心用浮点数表示,即n/2。数组不单调,要使最终结果为正确的值,只要将正确的值转移到最终的位置上即可,转移时不可改变原二分路径。

wyzkeyy的博客 751

嵌入式 AI 编程实战:从芯片到 AI 工具链---总结笔记

嵌入式 AI 编程实战:从芯片到 AI 工具链---总结笔记

weixin_42162924的博客 97

Codeforces Round 935 (Div. 3) (A~E)

CF Round935 div3 题解

2301_80105412的博客 585

lwip-2.0.3

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

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Codeforces Round 935 (Div. 3)

建一条道路来划分当前n个人,每个人有编号0和1,0代表想在左边住,1代表想在右边住,划分后左右两边单边满意的人数要比不满意的人多,找出划分道路的点,多个答案符合条件的情况下,道路尽可能靠中间。小明在n+1位置排队,他可以通过加钱来到达比自己当前位置靠前的i位置,到第i位置需要给第i个人ai硬币,给i到自己当前位置的人每人bi枚硬币,小明需要至少在第m人前面,最少需要花费多少硬币。题意:分帐篷,一个帐篷最多住仨人,a人社恐,一人一间,b人必须三人一间,c人随便,最少多少个帐篷,或者不能分。

maisui12138的博客 1232

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Codeforces Round 935

Codeforces Round 935

青少年趣味编程 674

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

Codeforces Round 935 (Div. 3) A B C D E

The organizing committee plans to take the participants of the Olympiad on a hike after the tour. Currently, the number of tents needed to be taken is being calculated. It is known that each tent can accommodate up to 333 people.Among the participants, the

InHng的博客 1325

每日一题 第十二期 Codeforces Round 935 (Div. 3)

A. Setting up Camptime limit per test: 1 secondmemory limit per test: 256 megabytesinput: standard inputoutput: standard outputThe organizing committee plans to take the participants of the Olympiad on a hike after the tour. Currently, the number of tents

2301_80882026的博客 1122

Codeforces Round 935 (Div. 3) A-E

Codeforces Round 935 (Div. 3) will start at Tuesday, March 19, 2024 at 16:05UTC+8. The problems are expected to compose an interesting competition for participants with ratings up to 1600. However, all of you who wish to take part and have a rating of 1600

KevenDuan的博客 1325

每日一题 第二十三期 Codeforces Round 935 (Div. 3)

【代码】每日一题 第二十三期 Codeforces Round 935 (Div. 3)

2301_80882026的博客 1143

每日一题 第十三期 Codeforces Round 935 (Div. 3)

aa2⋅a3⋅abb2⋅b3⋅bm1xxtoxmmt1≤t≤104abm1≤abm≤1018ExampleinputCopy66 7 43 4 107 8 561 1 1outputCopy2717456772171129566370778491981051128566472808896104112CF真的纯纯都是思维题啊。

2301_80882026的博客 749

Codeforces Round 968

Codeforces Round 968

青少年趣味编程 706

Codeforces Round 966

Codeforces Round 966

青少年趣味编程 926

Codeforces Round 935 (Div. 3) (A~G)

题意:三种人安排住宿,a只能跟自己住,b只能三个人住,c能1~3个人,问最终最少房间数思路:a单独安排,b放一起,不足三个人的用c补,然后c按照3人一房间尽可能分配题意:装置A每a分钟放一次烟花,装置B每b分钟放一次烟花,烟花能存在m分钟,求空中同时存在最多多少烟花.思路:两只烟花必然能同时放,然后再看接下来m分钟能放多少只烟花,这样必然最优题意:给定01串,要求从中间某个位置分开,其中左侧0的数量大于等于1的数量,右侧1的数量大于等于0的数量,求满足条件的最靠近中心的位置。思路:直接模拟。

weixin_61825750的博客 1476

Codeforces Round 971

Codeforces Round 971

青少年趣味编程 1514

Codeforces Round 935 (Div. 3) A~F

组委会计划在游览结束后带领奥林匹克运动会的参赛选手进行徒步旅行。目前,正在计算需要的帐篷数量。据了解,每个帐篷最多可容纳3人。在参赛者中,有a个内向者,b个外向者,c组委会非常尊重每位参赛者的意愿,因此他们希望满足所有参赛者的愿望。请告诉我们至少需要多少顶帐篷,以便所有参加者都能根据自己的喜好找到住处。如果无法满足所有参与者的愿望,输出−1。

Code_Shark的博客 963
上一篇: Codeforces Round 916 (Div. 3)A~E2
下一篇: L2-024. 部落-PAT团体程序设计天梯赛GPLT(tarjan缩点)
Enjoycola_
博客等级 码龄4年 93粉丝 63原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址