CodeForces 1409E Two Platforms】的更多相关文章

题意 有 \(n\) 个点,分别位于 \((x_i,y_i)\),求最多能用两个长度为 \(k\) 的平台接住多少个点. \(\texttt{Data Range:}n\leq 2\times 10^5,k\leq 10^9\) 题解 这是 Div.3 的 E 啊,为什么你们的写法都这么繁琐啊-- 这题可以不用任何数据结构,甚至双指针都可以不用的啊,而且代码还短,为什么你们都不这样写啊 注意到 \(y\) 坐标没什么卵用,所以只需要考虑 \(x\) 坐标即可. 同时有一个结论:在某个最优的方案中…
C. Platforms Jumping There is a river of width n. The left bank of the river is cell 0 and the right bank is cell n+1 (more formally, the river can be represented as a sequence of n+2 cells numbered from 0 to n+1). There are also m wooden platforms o…
There is a river of width nn. The left bank of the river is cell 00 and the right bank is cell n+1n+1 (more formally, the river can be represented as a sequence of n+2n+2 cells numbered from 00 to n+1n+1). There are also mm wooden platforms on a rive…
题意:有\(n\)个点往下落,你可以在最下面放两个长度为\(k\)的板子,问做多能接到多少个点. 题解:这题给纵坐标\(y\)完全没有用,我们先对横坐标\(x\)排序,然后从左边开始枚举,用\(l[i]\)记录\([1,i]\)中,一块板子最多能接到的点,然后再从右开始枚举,用\(r[i]\)记录\([i,n]\)中,一块板子最多能接到的点,最后遍历所有横坐标,维护\(l[i]+r[i+1]\)的最大值即可,其实可以理解为\(l[]\)就是第一块板子,\(r[]\)就是第二块板子. 代码: in…
Problem I. Instruction 题目连接: http://codeforces.com/gym/100531/attachments Description Ingrid is a head of a big railway station and, among other duties, is responsible for routing trains to the right platforms. The station has one entrance, and there…
C. Fragile Bridges 题目连接: http://codeforces.com/contest/201/problem/C Description You are playing a video game and you have just reached the bonus level, where the only possible goal is to score as many points as possible. Being a perfectionist, you'v…
链接: https://codeforces.com/contest/1238/problem/C 题意: You are playing a game where your character should overcome different obstacles. The current problem is to come down from a cliff. The cliff has height h, and there is a moving platform on each he…
https://codeforces.com/contest/1256 A:Payment Without Change[思维] 题意:给你a个价值n的物品和b个价值1的物品,问是否存在取物方案使得价值为s 题解:min(s/n,a)*n+b>=s?YES:NO #include<iostream> #include<cstdio> #include<cstdlib> #include<cmath> #include<algorithm>…
比赛链接:https://codeforces.com/contest/1409 A. Yet Another Two Integers Problem 题意 给出两个数 $a$ 和 $b$,有以下两种操作: $a+=k$ $a-=k$ $k \in [1, 10]$ 问将 $a$ 变为 $b$ 最少需要操作多少次. 题解 $a,b$ 之差的绝对值对 $10$ 取上整. 代码 #include <bits/stdc++.h> using namespace std; void solve()…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…