Codeforces Educational round 58
Ediv2 58
- 随手AK.jpg
D
裸的虚树,在这里就不写了
E
傻逼贪心?这个题过的比$B$都多.jpg
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 500005
#define ll long long
int n,now_mx,maxx;char s[10];
int main()
{
scanf("%d",&n);
while(n--)
{
int x,y;scanf("%s%d%d",s+1,&x,&y);
if(x<y)swap(x,y);
if(s[1]=='+')now_mx=max(x,now_mx),maxx=max(y,maxx);
else puts(x>=now_mx&&y>=maxx?"YES":"NO");
}
}
F
似乎正解的那个单调队列做法没啥意思啊...
直接暴力二分+剪枝就好了...
然后其实能卡掉,但是懒得去卡了.jpg
然后卡一卡常数就好了.jpg
随便剪一剪枝前测就能过.jpg
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 405
#define ll long long
int a[N],n,m,s,t,f,c,l,r;ll ans;
inline bool check(int x)
{
register int i,tc=c;register int now=x;
for(i=s;i<t;i++)
{
if(a[i+1]-a[i]>x)return 0;
if(a[i+1]-a[i]>now)
{
if(!tc)return 0;
tc--;now=x;
}
now-=a[i+1]-a[i];
}return 1;
}
int main()
{
scanf("%d%d",&n,&m);l=0,r=1<<30;
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
while(m--)
{
scanf("%d%d%d%d",&s,&t,&f,&c);if(s>t)swap(s,t);
if(check(ans/f))continue;
l=(ans/f)+1;r=a[t]-a[s];
while(l<r)
{
int mid=(l+r)>>1;
if(check(mid))r=mid;else l=mid+1;
}ans=max((ll)l*f,ans);
}
printf("%lld\n",ans);
}
G
一个结论,能划分出的段数是线性基里的基的个数
证明嘛:
对于任意一个已经存在的基,都可以被一些数表达出来
然后就可以发现,不可能存在一个划分的段数比线性基里的基数更多(根据线性基的定义
然后就完了.jpg
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <iostream>
#include <bitset>
using namespace std;
#define N 200005
#define ll long long
int a[32],now;
void insert(int x)
{
for(int i=30;~i;i--)if((x>>i)&1)
if(a[i])x^=a[i];
else {a[i]=x;return ;}
}
int main()
{
int n,x;
scanf("%d",&n);
while(n--)scanf("%d",&x),insert(x),now^=x;
if(!now)return puts("-1"),0;
x=0;
for(int i=30;~i;i--)if(a[i])x++;
printf("%d\n",x);
}
Codeforces Educational round 58的更多相关文章
- Codeforces Educational Round 33 题解
题目链接 Codeforces Educational Round 33 Problem A 按照题目模拟,中间发现不对就直接输出NO. #include <bits/stdc++.h> ...
- Codeforces Educational Round 92 赛后解题报告(A-G)
Codeforces Educational Round 92 赛后解题报告 惨 huayucaiji 惨 A. LCM Problem 赛前:A题嘛,总归简单的咯 赛后:A题这种**题居然想了20m ...
- [CodeForces]Educational Round 52
幸好我没有打这场,我VP的时候在C题就卡死了,我果然还是太菜了. A Vasya and Chocolate 题意:一个巧克力\(c\)元,买\(a\)赠\(b\),一共有\(n\)元,问能买几个巧克 ...
- Codeforces Educational Round 37
Solved CodeForces 920A Water The Garden Solved CodeForces 920B Tea Queue Solved CodeForces ...
- Codeforces Educational Round 57
这场出题人好像特别喜欢998244353,每个题里都放一个 A.Find Divisible 考察选手对输入输出的掌握 输出l 2*l即可(为啥你要放这个题,凑字数吗 #include<cstd ...
- Codeforces Educational Round 23
A emmmmmmmmm B emmmmmmmmm C(套路) 题意: 给定n和s(n,s<=1e18),计算n以内有多少个数x满足(x-x的各个位置数字之和)>=s 分析: 容易想到如果 ...
- Codeforces Educational Round 21
A =w= B qwq C wvw D(multiset) 题意: 有n(n<=1e5)个数,希望通过把一个位置y的数字放到位置x上这个操作,使得新序列的某个前缀和等于总和的一半,问这样的操作是 ...
- codeforces educational round 25
A 出题人不给样例解释...具体程序 #include<bits/stdc++.h> using namespace std; int n; ]; int main() { scanf() ...
- [Codeforces Educational Round 71]Div. 2
总结 手速场...像我这种没手速的就直接炸了... 辣鸡 E 题交互,少打了个 ? 调了半个小时... 到最后没时间 G 题题都没看就结束了...结果早上起来被告知是阿狸的打字机...看了看题一毛一样 ...
随机推荐
- 【代码笔记】iOS-请求去掉url中的空格
一,代码. - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, ...
- springboot项目中js、css静态文件路径访问
springboot静态文件访问的问题,相信大家也有遇到这个问题,如下图项目结构. 项目结构如上所示,静态页面引入js.css如下所示. 大家肯定都是这样写的,但是运行的话就是出不来效果,图片也不显示 ...
- css inline元素和inline-block元素之间缝隙产生原因和解决办法
行内元素产生水平空隙的原因及解决方案 这篇文章讲的很好,但是提供的解决方案没有这篇好实现 去除inline-block元素间间距的N种方法
- SD从零开始29-30
SD从零开始29 外向交货单处理中的特殊功能 批次Batches 你可以在material handled in batches的相关详细屏幕指定一个batch(物料是否使用batches来处理标记在 ...
- 敏捷开发的道与术---MPD软件工作坊培训感想(上)
注:由麦思博(MSUP)主办的2013年亚太软件研发团队管理峰会(以下简称MPD大会)分别于6月15及6月22日在北京.上海举办,葡萄城的部分程序员参加了上海的会议,本文是参会的一些感受和心得. 这次 ...
- CVE-2018-18820 icecast 栈缓冲区越界写漏洞分析
前言 icecast 是一款开源的流媒体服务器 , 当服务器配置了 url 认证时,服务器在处理 HTTP 头部字段时错误的使用了 snprintf 导致栈缓冲区的越界写漏洞( CVE-2018-18 ...
- Adapter中用不了getWindowManager()
在写popupwindow的时候一般会获取屏幕的宽高来设置popupwindow的宽高,但是在adapter中用不了getWindowManager(), 但是为什么Activity中就可以用getW ...
- [SSRS / RV] (.rdlc报表)冻结表头,固定行列标题
转自:https://blog.csdn.net/dietime1943/article/details/72846171?utm_source=blogxgwz9 Reporting Service ...
- Saltstack安装配置过程
一.安装配置 1.服务器配置情况 三台服务器,均需要关闭iptables和selinux(否则salt执行指令无效) master: 192.168.60.139 centos slave: 192. ...
- Oracle EBS OM 保留订单
DECLARE l_header_rec OE_ORDER_PUB.Header_Rec_Type; l_line_tbl OE_ORDER_PUB.Line_Tbl_Type; l_action_r ...