Lyft Level 5 Challenge 2018 - Elimination Round翻车记
打猝死场感觉非常作死。
A:判一下起点和终点是否在其两侧即可。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
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;
}
#define N
int n,ax,ay,bx,by,cx,cy;
int main()
{
n=read(),ax=read(),ay=read(),bx=read(),by=read(),cx=read(),cy=read();
if (bx<ax&&cx>ax||bx>ax&&cx<ax||by<ay&&cy>ay||by>ay&&cy<ay) cout<<"NO";
else cout<<"YES";
return ;
}
B:由平方差公式,当且仅当a-b=1且a+b为质数时a2-b2是质数。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
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;
}
#define ll long long
int T;
ll n,m;
int main()
{
T=read();
while (T--)
{
cin>>n>>m;
ll a=n+m,b=n-m;
if (b>) {cout<<"NO\n";continue;}
bool flag=;
for (ll i=;i*i<=a;i++)
if (a%i==) {flag=;break;}
if (flag) cout<<"YES\n";
else cout<<"NO\n";
}
return ;
}
C:若后继状态都为必胜态则该状态为必败态,否则为必胜态。可以按数从大到小暴力更新,由调和级数复杂度是有保证的。
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
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;
}
#define N 100010
int n,a[N],id[N],flag[N];
int main()
{
n=read();
for (int i=;i<=n;i++) id[a[i]=read()]=i;
memset(flag,,sizeof(flag));
flag[id[n]]=;
for (int i=n-;i>=;i--)
{
int x=id[i];
for (int j=x-i;j>=;j-=i)
if (a[j]>i&&!flag[j]) {flag[x]=;break;}
if (flag[x]==-)
for (int j=x+i;j<=n;j+=i)
if (a[j]>i&&!flag[j]) {flag[x]=;break;}
if (flag[x]==-) flag[x]=;
}
for (int i=;i<=n;i++) if (flag[i]) printf("A");else printf("B");
return ;
}
D:因子个数在3~5之间仅有这几种情况:pq,p2,p3,p4。对于p的幂次情况可以直接开方计算,将所有所得质数保存下来。然后考虑pq,将这个数除掉其与之前出现的所有质数的gcd,剩下的就是新出现的质因子了。开始直接交了一发泼辣的肉不出意外的T掉了。然后可能因为太晚了脑子不清醒,以奇怪的方式开始码正解,前前后后交了五次最后还是fst掉了。
E、F、G:怎么可能会啊。
result:rank437 rating+7
Lyft Level 5 Challenge 2018 - Elimination Round翻车记的更多相关文章
- [Lyft Level 5 Challenge 2018 - Elimination Round][Codeforces 1033D. Divisors]
题目链接:1033D - Divisors 题目大意:给定\(n\)个数\(a_i\),每个数的约数个数为3到5个,求\(\prod_{i=1}^{n}a_i\)的约数个数.其中\(1 \leq n ...
- Lyft Level 5 Challenge 2018 - Elimination Round
A. King Escape 签. #include <bits/stdc++.h> using namespace std; ], y[]; int f1(int X, int Y) { ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) (前三题题解)
这场比赛好毒瘤哇,看第四题好像是中国人出的,怕不是dllxl出的. 第四道什么鬼,互动题不说,花了四十五分钟看懂题目,都想砸电脑了.然后发现不会,互动题从来没做过. 不过这次新号上蓝名了(我才不告诉你 ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) B 1075B (思维)
B. Taxi drivers and Lyft time limit per test 1 second memory limit per test 256 megabytes input stan ...
- Lyft Level 5 Challenge 2018 - Final Round Div. 1没翻车记
夜晚使人着迷.没有猝死非常感动. A:显然对于水平线段,只有横坐标的左端点为1的时候才可能对答案产生影响:对于竖直直线,如果要删一定是删去一段前缀.枚举竖直直线删到哪一条,记一下需要删几条水平线段就可 ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2)---ABC
A---The King's Race http://codeforces.com/contest/1075/problem/A 题意: 一个人在\((1,1)\), 一个人在\((n,n)\), 现 ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2)
A. The King's Race 签. #include <bits/stdc++.h> using namespace std; #define ll long long ll n, ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) C. The Tower is Going Home(思维+双指针)
https://codeforces.com/contest/1075/problem/C 题意 一个宽为1e9*1e9的矩阵中的左下角,放置一个车(车可以移动到同一行或同一列),放置一些墙,竖的占据 ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2) A. The King's Race
http://codeforces.com/contest/1075/problem/A On a chessboard with a width of nn and a height of nn, ...
随机推荐
- lnmp环境搭建(centos6.9+mysql5.7+php7.1+nginx1.10)
安装前准备:CentOS 6.9 64位 最小化安装 yum install -y make gcc gcc-c++ perl zlib-devel libaio libpng libpng-deve ...
- idea 从javadoc中复制内容出来
打开 tool window就行了 经验:百度google不到的东西太多了,要学会自己想办法,至少也要把功能都试一遍吧, 而且像这种东西官方一般会给方法实现你的目的,只不过有时候是把功能迁移了或者整合 ...
- CentOS7安装及配置vsftpd (FTP服务器)
CentOS7安装及配置vsftpd (FTP服务器) 1.安装vsftpd 1 yum -y install vsftpd 2.设置开机启动 1 systemctl enable vsftpd 3. ...
- php小项目小结
最近一直断更,并不是出于什么问题,而是想找个合适的机会去整理下html基本的一些琐碎的知识点 近期突发感冒,吊水,吊错药,原因只是重名重姓,这不是个梗,很是痛苦的现实事故 so,只能用剩下的半天去完成 ...
- Spring学习(六)-----Spring使用@Autowired注解自动装配
Spring使用@Autowired注解自动装配 在上一篇 Spring学习(三)-----Spring自动装配Beans示例中,它会匹配当前Spring容器任何bean的属性自动装配.在大多数情况下 ...
- MySQL数据库--连接
MySQL数据库的概念: MySQL数据库,包括客户端和服务端.客户端就是操作数据库的终端(命令行.navicat),服务端就是安装有MySQL软件的主机(本机或者服务器),MySQL数据库的端口一般 ...
- Linux 安装Redis<准备>(使用Mac远程访问)
阅读本文需要一定的Linux基础 一 Redis简介 redis是用c语言编写的一款开源的高性能键值对(key-value)数据库 它通过提供多种键值数据类型来适应不同场景下的存储需求 二 Redis ...
- Unity面试问题归总
Unity面试问题归总 C#中Struct和Class的区别 Struct是Class的一种 A*寻路 https://blog.csdn.net/windcao/article/details/15 ...
- adb shell top 命令详解
[?25l[0m[H[J 当前系统时间 Tasks: 552 total, 1 running, 510 sleeping, 0 stopped, 0 zombie 任务(进程) 系统现在共有552个 ...
- vim—多行注释、取消多行注释
多行注释 命令模式: (1)将光标放在要注释的行首,按下组合键ctrl + v ,然后按上下键选取要注释的行. (2)按下大i键,然后插入要注释的符号 # (3)按ESC键,退出后,就会全部注释. 取 ...