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 题题都没看就结束了...结果早上起来被告知是阿狸的打字机...看了看题一毛一样 ...
随机推荐
- Spring boot初入门
1. Spring的Java配置方式 Java配置是Spring4.x推荐的配置方式,可以完全替代xml配置. 1.1. @Configuration 和 @Bean Spring的Java配置方式是 ...
- Atitit.web的自动化操作与信息抓取 attilax总结
Atitit.web的自动化操作与信息抓取 attilax总结 1. Web操作自动化工具,可以简单的划分为2大派系: 1.录制回放 2.手工编写0 U' z; D! s2 d/ Q! ^1 2. 常 ...
- VMware 15 安装 MAC OS 10.13 原版(详细图文教程)
VMware 15 安装 MAC OS 10.13 原版(详细图文教程) 生命在于折腾,之前本想装个双系统黑苹果,什么 U 盘启动盘,四叶草引导,都配置好了,最后跪在一个动态卷上,备份格盘现在弄不了, ...
- apktool逆向apk包
在AndroidStudio创建so一节里创建了so,并且在java里面调用so的HelloWorld方法,编译Android Studio后生成包app-debug.apk. 在逆向apk时如果该a ...
- Express浅谈
写给鸟自己的,大家如果不慎百度到这里来了,真好也在做这块功能,不懂的可以联系鸟.微信:jkxx123321 const Sequelize = require('sequelize'); const ...
- matlab练习程序(单层感知器)
clear all; close all; clc; %生成两组已标记数据 randn(); mu1=[ ]; S1=[ ; ; 0.4]; P1=mvnrnd(mu1,S1,); mu2=[ ]; ...
- 结合 Redis 实现同步锁
1.技术方案 1.1.redis的基本命令 1)SETNX命令(SET if Not eXists) 语法:SETNX key value 功能:当且仅当 key 不存在,将 key 的值设为 val ...
- IE8 下面通过滤镜的方式进行图片旋转
首先,为什么我会提出这样的方式来进行操作呢?原因还是需求导致: 在做项目中,有这样一个需求,在进行网页中图片查看的时候,需要对图片的操作有支持旋转和缩放这些操作,看似这样的网上插件有很多,对!但是对于 ...
- 关于npm run build打包后css样式中的图片失效的问题(如background)
平时run dev都能正常显示的css背景图片在npm run build打包后竟然不显示了(写在标签对中的图片都可以正常显示),而且dist/static/img目录下是确实有这张图片的,于是查看打 ...
- pycharm的放大和缩小字体的显示 和ubunt的截圖工具使用 ubuntu上安装qq微信等工具
https://www.cnblogs.com/sui776265233/p/9322074.html#_label0 ubuntu: 截圖工具的使用 在ubuntu 10.04 的时候,还可以很方便 ...