题目链接: B. Searching Rectangles time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Filya just learned new geometry object — rectangle. He is given a field consisting of n × n unit cells. Rows ar…
D. Searching Rectangles 题目连接: http://codeforces.com/contest/714/problem/D Description Filya just learned new geometry object - rectangle. He is given a field consisting of n × n unit cells. Rows are numbered from bottom to top with integer from 1 to…
题目链接 \(Description\) 在一个\(n*n\)的二维平面中有两个不相交的整点矩形,每次可以询问两个矩形有几个完全在你给出的一个矩形中.200次询问内确定两个矩形坐标. \(Solution\) 容易想到二分.整个矩形好像不好判断?那就每次二分判断矩形两个点的横纵坐标.次数为 8*26<200. 前四次二分可以确定出一个矩形的位置.然后第二个矩形就可以根据第一个求了. #include <cstdio> #include <cctype> #define gc(…
C - Preparing for the Contest Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 377B Description Soon there will be held the world's largest programming contest, but the testing system sti…
题目链接:Codeforces 484B Maximum Value 题目大意:给定一个序列,找到连个数ai和aj,ai%aj尽量大,而且ai≥aj 解题思路:类似于素数筛选法的方式,每次枚举aj,然后枚举k,每次用二分找到小于k∗aj而且最大的ai,维护答案,过程中加了一些剪枝. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn =…
题目链接:https://codeforces.com/problemset/problem/607/A 题意: 有 $n$ 个塔排成一行,第 $i$ 个激光塔的位置为 $a_i$,伤害范围是 $b_i$,激活第 $i$ 个塔后,所有在这个塔左侧且距离小于等于 $b_i$ 的塔都会被摧毁,但该塔本身不会被摧毁. 现在会从右向左依次激活每个塔,如果一个塔被摧毁则无法被激活. 现在要在这 $n$ 个激光塔的右边再放一个塔,该塔的位置和威力是任意的.现在从这个新加入的塔开始从右到左依次激活每个塔,求最…
You are given two strings s and t consisting of small Latin letters, string s can also contain '?' characters. Suitability of string s is calculated by following metric: Any two letters can be swapped positions, these operations can be performed arbi…
D. Leaving Auction time limit per test: 2 seconds memory limit per test:256 megabytes input:standard input output:standard output There are n people taking part in auction today. The rules of auction are classical. There were n bids made, though it's…
https://codeforces.com/contest/1117/problem/C 题意 在一个二维坐标轴上给你一个起点一个终点(x,y<=1e9),然后给你一串字符串代表每一秒的风向,然后每一秒你也可以选择一个方向移动,问到达从起点到终点的最短时间 题解 思维:等效法 假如到达终点之后,可以静止不动,可以用自己走反向风方向来抵消风的方向 先只考虑风向,用前缀和将每一秒到达的位置维护出来,假设x秒到达的位置是[x,y],终点为[sx,sy],则若|sx-x|+|sy-y|<=x,则一定…
$ >Codeforces \space 372 B.  Counting Rectangles is Fun<$ 题目大意 : 给出一个 \(n \times m\) 的 \(01\) 矩阵,有 \(q\) 次询问,每次给出一个矩形 $ x_1, x_2, y_1, y_2$ ,求有多这个矩形的有多少个全 \(0\) 子矩形 \(1 \leq n, m \leq 50, 1 \leq q \leq 3 \times 10^5\) 解题思路 : 设 \(g(x, y, l, r)\) 表示以…