当前位置:网站首页>uva1421
uva1421
2022-07-27 20:09:00 【Stab the bear with a knife】
#include <iostream>
#include <istream>
#include <sstream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
const int maxn = 5005;
const double ex = 1e-7;
int w,n;
struct Node {
double d, l, r;
bool operator<(const Node& input) {
return d < input.d;
}
}node[maxn];
int check(double x) {
double l = atan2(node[0].d, node[0].r - x), r = atan2(node[0].d, node[0].l - x);
for (int i = 1; i < n; i++) {
double ll = atan2(node[i].d, node[i].r - x);
double rr = atan2(node[i].d, node[i].l - x);
// The current angle is too big It needs to be moved to the right to become smaller
if (ll - r > ex) return 1;
// The current angle is too small Need to move left to get bigger
if (rr - l < -ex) return -1;
l = max(ll, l);
r = min(rr, r);
}
// Can wear
return 0;
}
bool IsOk() {
double l = 0, r = w;
while (r - l > ex) {
double mid = (r + l) / 2;
int ret = check(mid);
if (ret == 0)return true;
else if (ret == 1) l = mid;
else r = mid;
}
return false;
}
int main()
{
int t;
cin >> t;
while (t--) {
cin >> w >> n;
for (int i = 0; i < n; i++) {
cin >> node[i].d >> node[i].l >> node[i].r;
}
sort(node, node + n);
if (IsOk())cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
边栏推荐
- Rodin 安装 SMT Solvers 插件
- 11.2DHCP
- 【PyTorch系列】PyTorch之torchvision 图像处理库详解
- [openbmc series] 4. Start the process and use qume to simulate ast2600 EVB
- 如何运行 kevinchappell / formBuilder
- GridView (implement table display icon)
- Introduction to basic cesium controls
- 由单片机XTALIN引脚和XTALOUT引脚导出的对晶体震荡电路的深入理解
- Online judge output overrun
- Underlying principle of mvcc
猜你喜欢

长安链数据存储源码分析

C# 后台GC 的前因后果

Adults have only one main job, but they have to pay a price. I was persuaded to step back by personnel, and I cried all night

‘vite‘ 不是内部或外部命令,也不是可运行的程序 或批处理文件

ECU的软硬件架构

成年人只有一份主业是要付出代价的,被人事劝退后,我哭了一整晚

中国业务型CDP白皮书 | 爱分析报告

第3章 基本操作

Understanding of basic concepts of channel capacity and channel bandwidth

Qtexttospeech class of QT realizes voice broadcast function
随机推荐
C171: attendance system
Online Judge 输出超限
高手勿进!写给初中级程序员以及还在大学修炼的“准程序员”的成长秘籍
第3章 基本操作
22年PMP考试【全真敏捷试题】
Dcm11- write the function and configuration of the data service ($2e) according to the identifier [based on DaVinci configurator classic]
真实案例,大学生接单被骗,希望大家不要被骗了【惨痛教训】
产品经理:排查下线上哪里冒出个“系统异常”的错误提示
Cesium常用坐标系详细介绍
C#网络应用编程,实验2:IP地址转换和域名解析练习
新库上线 | CnOpenData中国全部专利详细地址数据
codeforces每日5题(均1500)-第二十四天
由单片机XTALIN引脚和XTALOUT引脚导出的对晶体震荡电路的深入理解
kubectl 获取pod日志 —— 筑梦之路
[C # network application programming] Experiment 3: process management exercise
VALN 11.9
antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique primary key
Introduction to basic cesium controls
uva1421
2022年,软件测试还能学吗?别学了,软件测试岗位饱和了...