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. esxi 主机用户功能说明

    1.  root 用户 默认情况下,每个 ESXi 主机都有一个具有管理员角色的 root 用户帐户.该 root 用户帐户可用于本地管理,并可用于将主机连接到 vCenter Server. 此公共 ...

  2. 【pwnable.kr】lotto

    pwnable.好像最近的几道题都不需要看汇编. ssh lotto@pwnable.kr -p2222 (pw:guest) 直接down下来源码 #include <stdio.h> ...

  3. 指令——free

    free指令 一个完整的指令的标准格式: Linux通用的格式——#指令主体(空格) [选项](空格) [操作对象] 一个指令可以包含多个选项,操作对象也可以是多个. free指令作用:查看内存使用情 ...

  4. Spring Boot -- Spring Boot之@Async异步调用、Mybatis、事务管理等

    这一节将在上一节的基础上,继续深入学习Spring Boot相关知识,其中主要包括@Async异步调用,@Value自定义参数.Mybatis.事务管理等. 本节所使用的代码是在上一节项目代码中,继续 ...

  5. 049-PHP输出当前文件的名称

    <?php echo __FILE__; //利用常量__FILE__输出当前文件的名称 ?>

  6. StackExchange.Redis.DLL 操作redis简化版

    直接引入StackExchange.Redis.dll来操作redis using Newtonsoft.Json; using StackExchange.Redis; using System; ...

  7. C#图片闪烁

    导致画面闪烁的关键原因分析:       一.绘制窗口由于大小位置状态改变进行重绘操作时      绘图窗口内容或大小每改变一次,都要调用Paint事件进行重绘操作,该操作会使画面重新刷新一次以维持窗 ...

  8. OleDbCommand 的用法

    OleDbCommand 的用法 OleDbConnection con=new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; dat ...

  9. CentOS7上防火墙操作

    firewalld打开关闭防火墙与端口 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl statu ...

  10. 对近期docker学习的总结

    Docker 总结 1. 说在前头(Docker命令的格式) docker中的对象分为4个(就目前我所学到的) 镜像 image 容器 container 网络 network 数据卷 volume ...