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, ...
随机推荐
- GBDT为什么不能并行,XGBoost却可以
传统的GBDT是以CART作为基分类器,xgboost还支持线性分类器,这个时候XGBOOST相当于带L1和L2正则化的逻辑斯蒂回归(分类问题)或者线性回归(回归问题).传统的GBDT在优化的hih只 ...
- angular之$watch() $watchGroup()和$watchCollection()
$watch $watch主要是用来监听一个对象,在对象发生变化时触发某个事件. 用法: $scope.$watch(watchFn,watchAction, deepWatch) 接下来讲一下这几个 ...
- c# 实体类怎么给LIST赋值,table转LIST
/// <summary> /// 缓存客服集合信息 /// </summary> public class model { /// <summary> /// 客 ...
- [备忘]Windows Server 2008 R2部署FTP FileZilla Server防火墙设置
有一台服务器,之前文件迁移少,现准备用FileZilla Server当FTP服务器,服务器系统是Windows Server 2008 R2,同样适用FileZilla Client连接服务器FTP ...
- 2018 ACM-ICPC World Finals - Beijing F.Go with the Flow
先枚举所有的列长度 对于每种列长度,然后里面用dp算 #include <algorithm> #include <cmath> #include <cstdio> ...
- tensorflow中使用mnist数据集训练全连接神经网络-学习笔记
tensorflow中使用mnist数据集训练全连接神经网络 ——学习曹健老师“人工智能实践:tensorflow笔记”的学习笔记, 感谢曹老师 前期准备:mnist数据集下载,并存入data目录: ...
- 3.Airflow使用
1. airflow简介2. 相关概念2.1 服务进程2.1.1. web server2.1.2. scheduler2.1.3. worker2.1.4. celery flower2.2 相关概 ...
- C++ STL 全排列
摘自爱国师哥博客https://www.cnblogs.com/aiguona/p/7304945.html 一.概念 从n个不同元素中任取m(m≤n)个元素,按照一定的顺序排列起来,叫做从n个不同元 ...
- 第一个scrum会议
第一阶段冲刺任务认领: PM薛哥: 让手电筒亮起来 梁哥: 代码测试 康哥: 用户反馈等等
- OOP 学习笔记汇总
1.1 引用 1.2 const关键字 1.3 动态内存分配 1.4 内联函数和重载函数函数参数缺省值 1.5 类和对象的基本概念与用法1 2.1 类和对象的基本概念2