A. Lame King

没啥好说的,先穿插着走,在直走

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fer(i,a,b) for(int i=a;i<=b;++i)
#define der(i,a,b) for(int i=a;i>=b;--i)
#define all(x) (x).begin(),(x).end()
#define pll pair<int,int>
#define et  cout<<'\n'
#define xx first
#define yy second
using namespace std;
template <typename _Tp>void input(_Tp &x){char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();if(f)x=-x;
}
template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);}
const int N=1e6+10;
signed main()
{int T;cin>>T;while(T--){int a,b;cin>>a>>b;a=abs(a);b=abs(b);if(a<b){swap(a,b);}cout<<b*2+max(0ll,(a-b)*2-1)<<endl;}
}

B. Vaccination

用一个队列存病人

原则就是,拖到最晚开一瓶药,开了之后尽量用没

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fer(i,a,b) for(int i=a;i<=b;++i)
#define der(i,a,b) for(int i=a;i>=b;--i)
#define all(x) (x).begin(),(x).end()
#define pll pair<int,int>
#define et  cout<<'\n'
#define xx first
#define yy second
using namespace std;
template <typename _Tp>void input(_Tp &x){char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();if(f)x=-x;
}
template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);}
const int N=1e6+10;
int a[N];
struct node{int canuse;int time;
};
signed main()
{int T;cin>>T;while(T--){int n,w,t1,tn;queue<int> br;cin>>n>>w>>t1>>tn;fer(i,1,n){cin>>a[i];br.push(a[i]);}int res=0;while(br.size()){auto noww=w;auto nowt=br.front()+t1+tn;while(noww&&nowt>=br.front()&&br.size()){noww--;br.pop();}res++;}cout<<res<<'\n';}
}

C. Pull Your Luck

等差数列求和,如果超出循环节还没有解就是No

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fer(i,a,b) for(int i=a;i<=b;++i)
#define der(i,a,b) for(int i=a;i>=b;--i)
#define all(x) (x).begin(),(x).end()
#define pll pair<int,int>
#define et  cout<<'\n'
#define xx first
#define yy second
using namespace std;
template <typename _Tp>void input(_Tp &x){char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();if(f)x=-x;
}
template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);}
const int N=1e6+10;
const int MX=1e6;
using namespace std;
const int mod=998244353;
int T;
int n,x,p;
signed main()
{ios::sync_with_stdio(0);cin.tie(0);int T;cin>>T;while(T--){cin>>n>>x>>p;int now=1;int fl=0;while(1){if(now>p){fl=0;break;}if(now>3*n){fl=0;break;}if(!((x+now*(now+1)/2%n)%n)){cout<<"Yes\n";fl=1;break;}now++;}if(!fl) cout<<"No\n";}return 0;
}

D. Accommodation

最少就是把所有连续的1都贪心成两室一厅

最多就是把把所有连续的0都贪心成两室一厅

注意不要超过限制(m/4,m/2)

(赛后被fst了,循环应该循环到m-1,没注意写成m了,出题人用*造数据)

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define fer(i,a,b) for(int i=a;i<=b;++i)
#define der(i,a,b) for(int i=a;i>=b;--i)
#define all(x) (x).begin(),(x).end()
#define pll pair<int,int>
#define et  cout<<'\n'
#define xx first
#define yy second
using namespace std;
template <typename _Tp>void input(_Tp &x){char ch(getchar());bool f(false);while(!isdigit(ch))f|=ch==45,ch=getchar();x=ch&15,ch=getchar();while(isdigit(ch))x=x*10+(ch&15),ch=getchar();if(f)x=-x;
}
template <typename _Tp,typename... Args>void input(_Tp &t,Args &...args){input(t);input(args...);}
using namespace std;
const int N=1e6+10;
string s;
int n,m,tmp;
int vis[N];
int calc1()
{int res=0;int cnt=0;fer(i,1,m){if(s[i]=='1') cnt++;else{res+=cnt/2;cnt=0;}}res+=cnt/2;if(res>m/4){res=m/4;}res=tmp-res;return res;
}
int calc2()
{int res=0;int cnt=0;cnt=tmp;fer(i,1,m-1){if(s[i]=='0'||s[i+1]=='0'){if(!vis[i]&&!vis[i+1]){vis[i]=1;vis[i+1]=1;res+=1;}}}int dis=min(m/4,res);res=m/4-dis;return cnt-res;
}signed main()
{ios::sync_with_stdio(0);cin.tie(0);cin>>n>>m;int ans1=0;int ans2=0;fer(i,1,n){cin>>s;s='0'+s;tmp=0;for(auto t:s){if(t=='1'){tmp++;}}fer(j,1,m){vis[j]=0;}ans1+=calc1();ans2+=calc2();}cout<<ans1<<" "<<ans2<<'\n';
}

Nebius Welcome Round (Div. 1 + Div. 2) 题解相关推荐

  1. Codeforces Round #586 (Div. 1 + Div. 2) B. Multiplication Table 思维 + 公式

    传送门 文章目录 题意: 思路: 题意: 给你一个n∗nn*nn∗n的矩阵,每个位置由ai∗aja_i*a_jai​∗aj​得来,主对角线为000,让你求出来aia_iai​. n≤1e3n\le1e ...

  2. Codeforces Round #586 (Div. 1 + Div. 2) D. Alex and Julian 数学 + 思维

    传送门 文章目录 题意: 思路: 题意: 给你一个无限个点的坐标轴,一个集合BBB,如果存在∣i−j∣=bk|i-j|=b_k∣i−j∣=bk​的话,那么i,ji,ji,j之间就连边.现在问你至少要从 ...

  3. Codeforces Round #733 (Div. 1 + Div. 2) E. Minimax 分情况讨论 + 思维

    传送门 文章目录 题意: 思路: 题意: 给你一个串,你可以随意安排这个串,使得这个串的每个前缀的kmpkmpkmp数组最大值最小,定义为f(a)f(a)f(a),并且字典序最小,输出安排之后的串. ...

  4. Deltix Round, Summer 2021 (open for everyone, rated, Div. 1 + Div. 2)

    Deltix Round, Summer 2021 (open for everyone, rated, Div. 1 + Div. 2) 题号 题目 知识点 A A Variety of Opera ...

  5. Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)

    Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2) 题号 题目 知识点 A Game of Life B Lor ...

  6. Codeforces Round #504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)切题报告(A-B题)

    这是我第二次参加CF比赛,也是第一次写博客,写得不好,望各位大佬海涵. A. Single Wildcard Pattern Matching 原题链接 这道题,这是难到让人无法直视,太水了. 题目大 ...

  7. [区间记忆化dp入门][Bribe the Prisoners SPOJ - GCJ1C09C][Codeforces Round #505D (rated, Div. 1 + Div. 2, ba]

    Bribe the Prisoners SPOJ - GCJ1C09C 作为这类题代表,f[i][j]代表第i点到第j点单独处理的最值 这题关键:释放某个囚犯后,就把囚犯分成两段,两段互相独立 这类d ...

  8. CodeTON Round 4 (Div. 1 + Div. 2, Rated, Prizes!)A~E

    比赛连接:Dashboard - CodeTON Round 4 (Div. 1 + Div. 2, Rated, Prizes!) - Codeforces A. Beautiful Sequenc ...

  9. Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)

    Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2) 题号 题目 知识点 A ...

  10. html css样式div属性,div css

    DIV+CSS是WEB设计标准,它是一种网页的布局方法.与传统中通过表格(table)布局定位的方式不同,它可以实现网页页面内容与表现相分离.提起DIV+CSS组合,还要从XHTML说起.XHTML是 ...

最新文章

  1. 计算机语言学教程,《语言学教程》-中文笔记(完整).doc
  2. Chapter 17 高级进程间通信
  3. 配置管理篇(0)_SaltStack 安装
  4. JSON序列化(stringify)对象时排除某些属性的两种方法
  5. createrepo常用参数
  6. 信息学奥赛一本通(C++)在线评测系统——基础(一)C++语言—— 1061:求整数的和与均值
  7. 【Android】Activity的四种launchMode
  8. poj 1338 Ugly Numbers(丑数模拟)
  9. 怎么通过media foundation将图像数据写入虚拟摄像头_[Camera]摄像头镜像
  10. Day08-函数(3)
  11. 中科院遥感与数字地球研究所博士后招聘
  12. python模拟浏览器下载文件_模拟浏览器下载文件?
  13. sql语句中遇到“被零除错误”提示的解决方法
  14. python安装及运行环境_Python 安装及环境搭建
  15. 百度editor编辑器添加新字体
  16. DC-DC转换器的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  17. Cassandra中Gossip具体实现方式
  18. Win:在 Windows Server 中的 NIC Teaming
  19. kubernetes in action读书笔记(四)ConfigMap、Secret、滚动升级、downwardAPI、Deployment、Statefulset
  20. display:dp:edid/e-edid/displayid

热门文章

  1. 外贸公司业务员和工厂外贸业务员的差别有哪些?
  2. 口胡各种程序设计语言
  3. (Frp第一篇)Frp内网穿透安装教程#Frps服务端一键安装脚本#
  4. 安卓虚拟机_你以为只有电脑才有虚拟机?手机虚拟机了解一下:原生安卓玩起来!...
  5. JavaScript(四):流程控制
  6. HBuilderX Wap2App(H5)打包APP去除顶部导航栏
  7. 【java养成】:案例(模拟银行新用户现金业务办理、USB接口程序设计、身份证校验位和身份提取)
  8. mavon-editor编辑器页面瞄点
  9. 计算机中剪切板的定义,在windows中剪切板是用来
  10. DELL 灵越 5423 黑苹果安装记录