A:签到。room里有一个用for写的,hack了一发1e8 1,结果用了大概600+ms跑过去了。惨绝人寰。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int n,m;
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
n=read(),m=read();
cout<<(n*-)/m++(n*-)/m++(n*-)/m+;
return ;
}

  B:讨论一发即可。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define N 1010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int n;
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
n=read();
while (n--)
{
int x=read(),y=read();
int p=y;if (y-x+&) y--;
int ans=x&?(y-x+>>):-(y-x+>>);
if (p-x+&) ans+=p&?-p:p;
printf("%d\n",ans);
}
return ;
}

  C:对矩形求个交,冷静一下瞎算算就行了。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define N 1010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
int read()
{
int x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int T,n,m;
ll area(int x1,int y1,int x2,int y2){if (x1>x2||y1>y2) return ;return 1ll*(x2-x1+)*(y2-y1+);}
ll calcwhite(int x1,int y1,int x2,int y2)
{
ll s=area(x1,y1,x2,y2);
if (x1+y1&) return s>>;
else return s+>>;
}
ll calcblack(int x1,int y1,int x2,int y2){return area(x1,y1,x2,y2)-calcwhite(x1,y1,x2,y2);}
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
T=read();
while (T--)
{
n=read(),m=read();
int x1=read(),y1=read(),x2=read(),y2=read();
int x3=read(),y3=read(),x4=read(),y4=read();
int x5=max(x1,x3),y5=max(y1,y3),x6=min(x2,x4),y6=min(y2,y4);
ll white=calcwhite(,,n,m),black=calcblack(,,n,m);
ll c1=calcblack(x1,y1,x2,y2);white+=c1,black-=c1;
black+=calcwhite(x3,y3,x4,y4),white-=calcwhite(x3,y3,x4,y4);
if (area(x5,y5,x6,y6)) black+=calcblack(x5,y5,x6,y6),white-=calcblack(x5,y5,x6,y6);
printf("%I64d %I64d\n",white,black);
}
return ;
}

  D:考虑答案为i时的最小和最大分裂次数是多少,各种递推式求通项到最后能捣鼓出来两个式子。显然答案若存在与n相差不会很大,暴力枚举check即可。当然式子不能直接算,需要各种乱搞防溢出。数学太差推一年。

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll unsigned long long
#define N 1010
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<''||c>'')) c=getchar();return c;}
int gcd(int n,int m){return m==?n:gcd(m,n%m);}
ll read()
{
ll x=,f=;char c=getchar();
while (c<''||c>'') {if (c=='-') f=-;c=getchar();}
while (c>=''&&c<='') x=(x<<)+(x<<)+(c^),c=getchar();
return x*f;
}
int T,n,m;
int main()
{
/*#ifndef ONLINE_JUDGE
freopen("a.in","r",stdin);
freopen("a.out","w",stdout);
#endif*/
T=read();
while (T--)
{
ll n=read(),m=read();
int ans=-;
for (int i=(n>=?n-:);i<n;i++)
{
ll k=;
for (int j=;j<=n-i+;j++) k<<=;
k-=n-i;k-=;
if (k<=m)
{
if (n+i+>=) {ans=i;break;}
ll k=;for (int j=;j<=n-i-;j++) k<<=;k--;ll t=k+;
for (int j=;j<=n+i+;j++)
{
k<<=;
if (k>=*m+) {ans=i;break;}
}
if (ans!=-) break;
t<<=;if (t>=*m+) {ans=i;break;}
t<<=;if (t>=*m+) {ans=i;break;}
k+=t;if (k>=*m+) {ans=i;break;}
t=;
for (int j=;j<=*i;j++)
{
t<<=;
if (t>=*m+) {ans=i;break;}
}
if (ans!=-) break;
k+=t;if (k>=*m+) {ans=i;break;}
}
}
if (ans==-) printf("NO\n");
else printf("YES %d\n",ans);
}
return ;
}

  E:这个条件比较显然的等价于子矩形中每一行都能重排成回文串(即出现次数为奇数的字母不超过一个)且对称行的字母组成相同。预处理每一行的每一段是否合法以及字母出现次数的哈希值,暴力枚举子矩形左右端点,对上下端点的每段合法区间马拉车即可。完全没时间写了。

  F:没看

  小号打的。result:rank 139 rating +92

Codeforces Round #524 Div. 2 翻车记的更多相关文章

  1. Codeforces Round#500 Div.2 翻车记

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  2. Codeforces Round#509 Div.2翻车记

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  3. Educational Codeforces Round 56 Div. 2 翻车记

    A:签到. B:仅当只有一种字符时无法构成非回文串. #include<iostream> #include<cstdio> #include<cmath> #in ...

  4. Educational Codeforces Round 55 Div. 2 翻车记

    A:签到. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> ...

  5. Codeforces Round#514 Div.2 翻车记

    A:签到 #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> # ...

  6. Codeforces Round#516 Div.1 翻车记

    A:开场懵逼.然后发现有人1min过,于是就sort了一下,于是就过了.正经证明的话,考虑回文串两端点一定是相同的,所以最多有Σcnti*(cnti+1)/2个,cnti为第i种字母出现次数.而sor ...

  7. Codeforces Round #517 Div. 1翻车记

    A:真的懵逼了.冷静了半天之后决定二分一下答案,然后先a安排上尽量小的再贪心地一个个扩大.40min才过.这个做法非常怂的以代码复杂度和时间复杂度为代价换取了比较稳的正确性,事实上由于1~n可以组合出 ...

  8. Educational Codeforces Round 53 Div. 2翻车记

    A:差点开场懵逼.只要有相邻两位不同就可以作为答案. #include<iostream> #include<cstdio> #include<cmath> #in ...

  9. Codeforces Round #524 (Div. 2)(前三题题解)

    这场比赛手速场+数学场,像我这样读题都读不大懂的蒟蒻表示呵呵呵. 第四题搞了半天,大概想出来了,但来不及(中途家里网炸了)查错,于是我交了两次丢了100分.幸亏这次没有掉rating. 比赛传送门:h ...

随机推荐

  1. 北京Uber优步司机奖励政策(4月8日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  2. 北京Uber优步司机奖励政策(3月26日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  3. Python:TypeError: 'range' object doesn't support item deletion

    报错代码: dataIndex = range(m) del (dataIndex[randIndex]) 报错信息: 错误原因: python3 range返回的是range对象,不是数组对象 解决 ...

  4. python之Queue

    一.多进程的消息队列 “消息队列”是在消息的传输过程中保存消息的容器 消息队列最经典的用法就是消费者和生成者之间通过消息管道来传递消息,消费者和生成者是不通的进程.生产者往管道中写消息,消费者从管道中 ...

  5. Tomcat7后台通过get接收数据处理乱码

    Tomcat7后台通过get接收数据处理乱码 //因为tomcat7 默认将用get传来的数据用ISO-8859-1封装, //将ajax传过来的值解码,再转码,//因为tomcat7 默认将用get ...

  6. SpringBoot入门(四)——自动配置

    本文来自网易云社区 SpringBoot之所以能够快速构建项目,得益于它的2个新特性,一个是起步依赖前面已经介绍过,另外一个则是自动配置.起步依赖用于降低项目依赖的复杂度,自动配置负责减少人工配置的工 ...

  7. Ruby基础教程 1-10

    类结构 1.数值类结构     Fixnum到Bignum会自动转换   2.常用数值表示   3. ans=10.divmod(3) ans[0]是商  ans[1]是余数   4.实例方法roun ...

  8. 那些年我们不爱学的mysql单词

    MySQL 一种关系型数据库 database 数据库,简称DB databases 数据库的复数,代表多个数据库 net 网络/服务 start 启动 stop 停止 root MySQL数据库中的 ...

  9. TPO-14 C2 Prepare for a career in journalism

    TPO-14 C2 Prepare for a career in journalism 第 1 段 1.Listen to a conversation between a student and ...

  10. leetcode-生成括号(回溯算法)

     转载出处:https://blog.csdn.net/yanerhao/article/details/68561290 生成括号     给出 n 代表生成括号的对数,请你写出一个函数,使其能够生 ...