A

B

被删了,被这个假题搞自闭了,显然没做出来。

C

开始莽了个NTT,后来发现会TLE,其实是个SB前缀和,对于这题,我无**说。

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+,mod=;
int n,m,ans,sum,s[N];
char a[N],b[N];
int main()
{
scanf("%s",a+),n=strlen(a+);
scanf("%s",b+),m=strlen(b+);
for(int i=;i<=n;i++)s[i]=s[i-]+(a[i]!=a[i-]);
for(int i=;i<=m;i++)sum+=a[i]!=b[i];
sum&=;
ans+=sum^;
for(int i=m+;i<=n;i++)
{
sum+=s[i]-s[i-m];
sum&=;
ans+=sum^;
}
printf("%d",ans);
}

D

我的做法是这样的:对于非整数,显然先把其下取整,发现比0小多少,然后发现能加几个值,贪心加即可。

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+;
int n,tot,a[N],b[N];
double sum;
double down(double x)
{
double ret=;
if(x>=)ret=trunc(x);else ret=trunc(x)-;
sum+=x-ret;
return ret;
}
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
{
double x;scanf("%lf",&x);
if(trunc(x)==x)a[i]=x;
else a[i]=down(x),b[i]=;
}
tot=sum+1e-;
for(int i=;i<=n&&tot;i++)if(b[i])tot--,a[i]++;
for(int i=;i<=n;i++)printf("%d\n",a[i]);
}

E

很容易发现每个(2n)*(2m)的矩阵和是一样的,不如直接扩展成(2n)*(2m),然后直接做一下就行了

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=;
int n,m,Q,s[N][N];
char str[N];
ll calc(int x,int y)
{
ll ret=(1ll*x*y-1ll*(x%n)*(y%m))/;
int t=x/n^y/m,num=;
while(t)num+=t&,t>>=;
if(num&)ret+=(x%n)*(y%m)-s[x%n][y%m];else ret+=s[x%n][y%m];
return ret;
}
int main()
{
scanf("%d%d%d",&n,&m,&Q);
for(int i=;i<=n;i++)
{
scanf("%s",str+);
for(int j=;j<=m;j++)s[i][j]=s[i+n][j+m]=str[j]-'',s[i+n][j]=s[i][j+m]=s[i][j]^;
}
n<<=,m<<=;
for(int i=;i<=n;i++)
for(int j=;j<=m;j++)
s[i][j]+=s[i-][j]+s[i][j-]-s[i-][j-];
while(Q--)
{
int a,b,c,d;scanf("%d%d%d%d",&a,&b,&c,&d);
printf("%I64d\n",calc(c,d)+calc(a-,b-)-calc(a-,d)-calc(c,b-));
}
}

F

显然从度数最小的点开始分配,然后贪心分配,即两端的点度数都不满就分配。然后xjb乱证明一通:∵Σdeg[i]=2m,所以Σ(deg[i]+1)/2<=Σdeg[i]/2+n<=m+n,于是发现每次分配度数不满的做法是可行的。

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+;
struct node{int u,v;};
bool operator<(node a,node b){return a.v>b.v;}
priority_queue<node>q;
int n,m,cnt,ret,tot,hd[N],v[N<<],nxt[N<<],w[N<<],mark[N],vis[N],deg[N],now[N],U[N],V[N];
void adde(int x,int y,int z){v[++cnt]=y,nxt[cnt]=hd[x],w[cnt]=z,hd[x]=cnt;}
int main()
{
scanf("%d%d",&n,&m);
for(int i=,x,y;i<=m;i++)
scanf("%d%d",&x,&y),U[i]=x,V[i]=y,adde(x,y,i),adde(y,x,i),deg[x]++,deg[y]++;
for(int i=;i<=n;i++)now[i]=deg[i];
ret=m;
for(int i=;i<=n;i++)q.push((node){i,deg[i]});
while(!q.empty())
{
if(ret<=(n+m+)/)break;
int u=q.top().u;q.pop();
if(vis[u])continue;
vis[u]=;
for(int i=hd[u];i&&now[u]!=(deg[u]+)/;i=nxt[i])
if(!mark[w[i]]&&now[v[i]]!=(deg[v[i]]+)/)
{
now[v[i]]--,now[u]--,ret--;
mark[w[i]]=;
q.push((node){v[i],now[v[i]]});
}
}
for(int i=;i<=m;i++)if(!mark[i])tot++;
printf("%d\n",tot);
for(int i=;i<=m;i++)if(!mark[i])printf("%d %d\n",U[i],V[i]);
}

Codeforces Round #571 (Unrated for Div. 1+Div. 2)的更多相关文章

  1. 【Codeforces Round 1129】Alex Lopashev Thanks-Round (Div. 1)

    Codeforces Round 1129 这场模拟比赛做了\(A1\).\(A2\).\(B\).\(C\),\(Div.1\)排名40. \(A\)题是道贪心,可以考虑每一个站点是分开来的,把目的 ...

  2. Educational Codeforces Round 64(Unrated for Div.1+Div. 2)

    什么垃圾比赛,A题说的什么鬼楞是没看懂.就我只会BD(其实C是个大水题二分),垃圾游戏,技不如人,肝败吓疯,告辞,口胡了E就睡觉了. B 很容易发现,存在一种方案,使得相同字母连在一起,然后发现,当字 ...

  3. Codeforces Round #571 (Div. 2)-D. Vus the Cossack and Numbers

    Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He ...

  4. Codeforces Round #571 (Div. 2)

    A. Vus the Cossack and a Contest 签. #include <bits/stdc++.h> using namespace std; int main() { ...

  5. Vus the Cossack and Strings(Codeforces Round #571 (Div. 2))(大佬的位运算实在是太强了!)

    C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist ...

  6. Codeforces Round #513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2) C D

    C - Maximum Subrectangle 因为是两个数组相乘的到的 矩阵所以  a(i ->j)*b(x->y) 的面积 就是   a(i ->j) 的和乘与b(x-> ...

  7. [Codeforces Round #513 by Barcelona Bootcamp (rated, Div. 1 + Div. 2) ](A~E)

    A: 题目大意:给你一个数字串,每个数字只可以用一次,求最多可以组成多少个电话号码(可以相同),电话号码第一个数字为$8$,且长度为$11$ 题解:限制为$8$的个数和总长度,直接求 卡点:无 C++ ...

  8. Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3)(A.B.C,3道暴力题,C可二分求解)

    A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard inp ...

  9. Codeforces Round#412 Div.2

    A. Is it rated? 题面 Is it rated? Here it is. The Ultimate Question of Competitive Programming, Codefo ...

随机推荐

  1. CF97B Superset超级集合

    CF97B Superset 这题主要是构造难想.看看数据范围发现连\(O(n^2)\)都被卡了,然后 考试的名称提醒我 想到了分治. 坐标按横坐标为关键字排序后找中间的点进行分治不是点分治qwq. ...

  2. Golang的类型转换实战案例

    Golang的类型转换实战案例 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.数据类型概述 基础数据类型概述,博主推荐阅读: 布尔型: https://www.cnblogs. ...

  3. 超低功耗2.4G收发一体: SI24R1

    Si24R1是一颗工作在2.4GHz ISM频段,专为低功耗无线场合设计,集成嵌入式ARQ基带协议引擎的无线收发器芯片.工作频率范围为2400MHz-2525MHz,共有126个1MHz带宽的信道.同 ...

  4. 修改序列(Sequence)的初始值(START WITH)

    1 执行:Alter Sequence SeqTest2010_S Increment By 1007; 2 执行:Select SeqTest2010_S.NextVal From Dual; 3 ...

  5. 《Python爬虫技术:深入理解原理、技术与开发》已经出版,送Python基础视频课程

    好消息,<Python爬虫技术:深入理解原理.技术与开发>已经出版!!!   JetBrains官方推荐图书!JetBrains官大中华区市场部经理赵磊作序!送Python基础视频课程!J ...

  6. 003、mysql输出多个结果

    SELECT VERSION(); SELECT NOW(); 结果1: 结果2: 不忘初心,如果您认为这篇文章有价值,认同作者的付出,可以微信二维码打赏任意金额给作者(微信号:382477247)哦 ...

  7. skLearn 支持向量机

    ## 版权所有,转帖注明出处 章节 SciKit-Learn 加载数据集 SciKit-Learn 数据集基本信息 SciKit-Learn 使用matplotlib可视化数据 SciKit-Lear ...

  8. Spring-ResolvableType可解决的数据类型

    ResolvableType,可解决的数据类型.它为java语言中的所有类型提供了相同的数据结构,其内部封装了一个java.lang.reflect.Type类型的对象. 在讲解这个数据结构之前,首先 ...

  9. 仿淘宝 vue

    最近自己闲着无聊,用vue仿照淘宝打算写个皮囊,顺便把遇到的问题顺便记录下 1.动画问题 (1)单个元素给动画 <transition name="fade">< ...

  10. 【剑指Offer】面试题07. 重建二叉树

    题目 输入某二叉树的前序遍历和中序遍历的结果,请重建该二叉树.假设输入的前序遍历和中序遍历的结果中都不含重复的数字. 例如,给出 前序遍历 preorder = [3,9,20,15,7] 中序遍历 ...