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. Android APP架构设计——MVC、MVP和MVVM介绍

    )对于过大的项目,数据绑定需要花费更多的内存. 关于APP的架构设计就介绍到这吧,转载请注明出处:http://blog.csdn.net/seu_calvin/article/details/529 ...

  2. 成都Uber优步司机奖励政策(3月21日)

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

  3. Error starting mongod. /var/run/mongodb/mongod.pid exists.启动mongodb报错

    linux上安装mongodb,启动时报上面的错,解决如下: 解决方法: 1.删除mongod.pid文件 rm -rf /var/run/mongodb/mongod.pid 2.修改/tmp/mo ...

  4. 只需两步,rails支持CSV格式导出

    一.Controller最上方添加 require 'csv' 二.方法里面添加 format.csv do csv_string = CSV.generate do |csv| csv <&l ...

  5. EF Core注意事项

    流程:https://docs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db 1.Both Entity Framework 6. ...

  6. 「日常训练」All Friends(POJ-2989)

    题意 分析 代码 #include <iostream> #include <cstring> #include <algorithm> #define MP ma ...

  7. 完整的正则表达式知识汇总(Python知识不断更新)

    ## 大纲: ## 一.正则概述 1.正则是什么 正则就是一套规则,或者语法 2.正则的作用 让我们判断是否符合我们的的规则,或者根据规则找到符合规则的数据 3.使用场景 可以用正则判断我们输入的邮箱 ...

  8. CSP201709-1:打酱油

    引言:CSP(http://www.cspro.org/lead/application/ccf/login.jsp)是由中国计算机学会(CCF)发起的"计算机职业资格认证"考试, ...

  9. 【MySQL解惑笔记】Navicat 无法远程连接MySQL数据库

    安装好Navicat之后远程连接MySQL数据库出现以下报错截图: 出现以上截图怀疑是mysql用户权限不够: GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.1 ...

  10. [CH0304]IncDec Sequence

    和NOIP2018DAY1T1类似的题目,但思维难度高多了. 这题既可以抬高路面,也可以降低路面,而且目标平面不确定,就难起来了. 但是两道题的基本思路几乎一样,同样我们将 2~n 的高度差分,1之所 ...