1 Star 1 Fork 0

bensonrachel/Atcoder_algorithm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
A. Binary Search(CF).py 897 Bytes
一键复制 编辑 原始数据 按行查看 历史
# -*- coding: utf-8 -*-
# @project : 《Atcoder》
# @Author : created by bensonrachel on 2021/7/12
# @File : A. Binary Search(CF).py
# https://codeforces.com/edu/course/2/lesson/6/1/practice/contest/283911/problem/A
def re(char,rate:list):
for i in rate:
if(i in char):
print("YES")
else:
print("NO")
def bisearch(l,r,char,x):
while(l+1<r):
mid = (l+r)//2
if(char[mid]==x):
return True
elif(char[mid]<x):
l =mid
else:
r =mid
return False
def bi(n,k,char,rate):
for i in rate:
if(bisearch(-1,n,char,i)):
print("YES")
else:
print("NO")
if __name__ == '__main__':
n,k = map(int,input().split())
char = [int(i) for i in input().split()]
rate = [int(i) for i in input().split()]
#re(char,rate)
bi(n,k,char,rate)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bensonrachel/atcoder_algorithm.git
git@gitee.com:bensonrachel/atcoder_algorithm.git
bensonrachel
atcoder_algorithm
Atcoder_algorithm
master

搜索帮助