Codeforces 424 B Megacity【贪心】

被Cloudflare 5秒盾虐了半个月,终用Python破局:UA+TLS指纹伪装实战,拦截率从42%干到3% 其实5秒盾不难破,难的是摸透它的检测逻辑——它不是“一刀切”地拦截爬虫,而是通过“多维度指纹校验”,判断你是不是“真实用户”。表层:UA和HTTP头要完整、匹配;中层:TLS指纹要和真实浏览器一致(核心);深层:行为要符合人类习惯(请求间隔、JS执行)。这套方案不仅适用于Cloudflare 5秒盾,很多基于指纹检测的反爬系统(如Akamai、Imperva)也适用。2025年的爬虫,早已不是“能爬就行”,而是“爬得稳、不被封”——指纹伪装就是实现这一点的关键。 阅读详情

The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided to achieve its goal by expanding the boundaries of the city.

The city of Tomsk can be represented as point on the plane with coordinates (0; 0). The city is surrounded with n other locations, the i-th one has coordinates (xi, yi) with the population of ki people. You can widen the city boundaries to a circle of radius r. In such case all locations inside the circle and on its border are included into the city.

Your goal is to write a program that will determine the minimum radius r, to which is necessary to expand the boundaries of Tomsk, so that it becomes a megacity.

Input

The first line of the input contains two integers n and s (1 ≤ n ≤ 103; 1 ≤ s < 106) — the number of locatons around Tomsk city and the population of the city. Then n lines follow. The i-th line contains three integers — the xi and yi coordinate values of the i-th location and the number ki of people in it (1 ≤ ki < 106). Each coordinate is an integer and doesn't exceed 104 in its absolute value.

It is guaranteed that no two locations are at the same point and no location is at point (0; 0).

Output

In the output, print "-1" (without the quotes), if Tomsk won't be able to become a megacity. Otherwise, in the first line print a single real number — the minimum radius of the circle that the city needs to expand to in order to become a megacity.

The answer is considered correct if the absolute or relative error don't exceed 10 - 6.

注意距离的正负!(2,2)和(-2,2)不是同一个点但是是相同的距离。

Examples
Input
4 999998
1 1 1
2 2 1
3 3 1
2 -2 1
Output
2.8284271
Input
4 999998
1 1 2
2 2 1
3 3 1
2 -2 1
Output
1.4142136
Input
2 1
1 1 999997
2 2 1
Output
-1
#include<iostream>  
#include<cstdio>  
#include<cstring> 
#include <cmath> 
#include<stack>
#include<vector>
#include<map> 
#include<set>
#include<queue> 
#include<algorithm>  
using namespace std;



int main(){
    int n,s;
    map<int,int> cnt;
    scanf("%d %d",&n,&s);
    int x,y,k;
    for(int i=1;i<=n;i++){
        cin>>x>>y>>k;
        cnt[x*x+y*y]+=k;
    }
    
    for(map<int,int>::iterator it=cnt.begin();it!=cnt.end();++it){
        s+=it->second;
        if(s>=1000000){
            printf("%lf\n",sqrt(it->first));
            return 0;
        }
    }
    printf("-1\n");
    return 0;
}

30分钟上手YOLO26 nano:INT8量化部署到智能相机,推理速度提升43% 微调代码(仅需5行,数据集遵循COCO格式)data="custom_data.yaml", # 数据集配置文件epochs=20, # 少量轮数即可收敛batch=8,imgsz=640model.save("yolov26n_custom.pt") # 保存微调后的模型本文在30分钟内完成了YOLO26 nano的INT8量化与智能相机部署,核心步骤为环境准备→模型获取→ONNX导出→INT8量化→部署推理。 阅读详情

相关推荐

从零搭建智能视觉小车:OpenART图像处理+增强现实避坑指南

本文详细指导如何从零搭建智能视觉小车,重点介绍OpenART图像处理与增强现实技术在AprilTag识别中的应用。涵盖硬件选型、环境配置、算法优化及实战调试全流程,特别分享智能汽车竞赛中的避坑技巧和优化方案,帮助开发者构建稳定高效的视觉系统。

yhn456789的博客 1055

Codeforces Round #242 (Div. 2) B

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_34138377的博客 209

360加固DEX解密与ELF修复技术解析

本文深入解析360加固的DEX解密与ELF修复技术,详细介绍了其多层保护机制、Java层入口分析、Native层加载流程及反调试绕过技巧。通过RC4和zlib解密技术,结合Frida工具实现内存Dump和ELF文件修复,为逆向工程师提供实用解决方案。

weixin_29327525的博客 511

codeforces 424B Megacity

Description The administration of the Tomsk Region firmly believes that it’s time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they de

wilver的博客 453

脑影像分析软件推荐 | JuSpace

JuSpace是一种允许基于 MRI 测量与核成像衍生估计的跨模态关联的工具包,它涵盖各种神经递质系统,包括多巴胺能、血清素能、去甲肾上腺素能和 GABA(γ-氨基丁酸) 神经传递。JuSpace 由一组 Matlab 功能以及涵盖各种受体系统的 PET 受体图谱组成。

NHKJ_ZF的博客 1708

美团mtgsig 3.1.0算法还原:从加密入口到d1生成的完整链路拆解

本文详细拆解了美团mtgsig 3.1.0签名算法的完整逆向过程。通过定位加密入口函数eH,理清a6、a5、a8到d1的生成依赖链,并运用插桩技术,在JSVMP混淆环境下逐步还原了核心参数的生成逻辑,为逆向工程实践提供了清晰的纯算还原方法论。

oo7890的博客 777

如何用Android-Next实现异步HTTP请求:替代Volley的完整教程

Android-Next是一个功能强大的Android公共组件库,提供了高效的异步HTTP请求功能,可作为Volley的理想替代品。本教程将详细介绍如何使用Android-Next实现各种异步HTTP请求,帮助开发者轻松处理网络通信任务。 ## 为什么选择Android-Next的HTTP组件? Android-Next的HTTP模块提供了比Volley更简洁的API和更灵活的配置选项。它基于

gitblog_00640的博客 1099

从0开始部署基础的AlwaysOn

在这个快餐文化盛行的时代,应该没多少人真的会沉下心来看理论和具体步骤,加上我自己也需要一篇可以扩展的快速搭建环境的指引,所以特别写了这篇文章。 我们在这里要做的事情有以下几个:安装环境。包括虚拟机和网络配置等。安装Windows域、配置必要的账号密码及功能。搭建域环境并进行配置。安装配置Windows Server Failover Cluster(WSFC)。安装SQL Server。配置Alw

MVP黄钊吉(發糞塗牆) 7568

CodeForces484A——Bits(贪心算法)

判断x在t1+1位为1的时候是否绝对大于R,绝对大于的话,就将t1+1赋值为0;设L,R的从高位开始有t1位相同,那么根据常识,x的前t1位(从高位开始数)必然也与LR相同。又因为L

m0_72431373的博客 303

基于高精度三维机器视觉的新能源汽车锂电池表面缺陷检测

在机器视觉行业迅速发展的背景下,市场上提供了功能强大且种类齐全的3D相机系列,可以满足锂电池从电芯到模组各个工艺和工位的3D检测需求。

Hinyeung_Limited的博客 1132

【课程设计】TCP/IP 应用环境中服务器的部署与实现

本项目旨在通过搭建一个虚拟网络环境,实现软路由系统的配置和服务器的搭建与测试。具体包括安装虚拟机 VMWare Workstation,安装 Windows Server 2003 操作系统,配置软路由系统(包括双网卡安装、协议配置和测试),以及搭建并测试 DHCP 服务、DNS 服务、WWW 服务、FTP 服务和 SMTP/POP3 服务。

weixin_74907236的博客 1524

Codeforces 845C. Two TVs 思路:简单贪心算法

题目: 题目原文链接:http://codeforces.com/contest/845/problem/C 题意:现在我们有一个电视清单,有两个电视,电视清单上有每一个节目的开始时间和结束时间。    电视不能接连不间断的播放,例如TV1播放完1-2点的节目后不能接着播放2-3点的电视,除非在TV2上播放,如果TV2也正在播放则不能播放完清单。 思路:   1.对...

weixin_30565327的博客 261

2025华为OD面试手撕代码真题目录、八股文真题目录以及面试技巧

1. **华为OD面试技术面准备指南** 2. **华为OD面试技术面常见问题解答** 3. **华为OD面试技术面经验分享** 4. **华为OD面试技术面注意事项** 5. **华为OD面试技术面攻略** 6. **华为OD面试技术面模拟题目与解析** 7. **华为OD面试技术面知识点梳理** 8. **华为OD面试技术面常考**

算法大师! 3万+

Codeforces--424B--Megacity

题目描述: The administration of the Tomsk Region firmly believes that it’s time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decided ...

猩猩是个好程序员的博客 270

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

CodeForces - 424B (贪心算法)

Megacity Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u SubmitStatus Description The administration of the Tomsk Region firmly believes t...

weixin_30466421的博客 105

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

codeforces上一道贪心算法题

http://codeforces.com/contest/218/problem/B 贪心算法: STL优先队列实现最大堆,最小堆 #include&lt;iostream&gt; #include&lt;queue&gt; using namespace std; const int MAX=1001; int a[MAX]; int calPrize(int n, in...

weixin_34208185的博客 152

解题报告:Codeforces Round #424 (Div. 2) A B C D E F

A. Unimodal Array 题目链接 题意: ①先严格递增 ②保存相等 ③严格递减 只要一个序列的大小变化顺序满足以上为unimodal 现在给定一个序列,询问是否为unimodal 思路: 分别定义三种情况为0,1,2 然后判断是否出现了倒序即可 代码: #include using namespace std; int n; int A[

Hee的博客~ 944

Codeforces Round #424 Div.2 B 【map】

B. Keyboard Layouts time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There are two popular keyboard layouts in Berland, they differ only in

lzs_lazy 314

Codeforces Round #424 B

Keyboard Layouts 题意:有2个映射关系,分别是将abcd...z映射到s1和s2,现在给你经过s1映射的字符串s,求经原字符串过s2映射后的字符串 思路:映射拿map xjb搞就是了 AC代码: #include "iostream" #include "string.h" #include "stack" #include "queue" #include "...

weixin_30426957的博客 136

贪心算法:CodeForces-597B

C - Restaurant CodeForces - 597B A restaurant receivednorders for the rental. Each rental order reserve the restaurant for a continuous period of time, thei-th order is characterized by two tim...

LOG_IN_ME的博客 425

Codeforces Round #424(A+B)

Array of integers is unimodal, if:it is strictly increasing in the beginning; after that it is constant; after that it is strictly decreasing. The first block (increasing) and the last block (decrea

妍恐龙的博客....^~^眼熟我 594

CodeForces - 462B(贪心算法)

原文链接:http://codeforces.com/problemset/problem/462/B 思路: 题目大概意思是说,给一个大写字母的序列,每个字母的得分是其出现的次数。现在要在这n个字符里找出k个字符,使得得分最大。求最大值。 是贪心算法的一道基本题。 思路的话,我们从输入入手,就是先统计输入的字符串中,每个字符各占多少。然后用sort进行排序,排序后按数量最多的开始拿,直到...

weixin_40175225的博客 321

[codeforces 1271D] Portals 反悔贪心算法

[codeforces 1271D] Portals 反悔贪心算法 总目录详见https://blog.youkuaiyun.com/mrcrack/article/details/103564004 在线测评地址http://codeforces.com/contest/1271/problem/D Problem Lang Verdict Time Memory 12...

mrcrack的博客 640

Codeforces Round #242 (Div. 2) B. Megacity

The administration of the Tomsk Region firmly believes that it's time to become a megacity (that is, get population of one million). Instead of improving the demographic situation, they decide...

weixin_33717117的博客 221

Codeforces 597B - Restaurant 贪心算法

Restaurant time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output A restaurant received n orders for the rental. Each rental order reserve the re...

DouglasConnor的博客 306
上一篇: More is better (并查集)
下一篇: HDU 2087 剪花布条(STL、暴力)
donCoder
博客等级 码龄9年 65粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值