[POI2014]Solar Panels】的更多相关文章

3834: [Poi2014]Solar Panels Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 367  Solved: 285[Submit][Status][Discuss] Description Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the go…
[BZOJ3834][Poi2014]Solar Panels Description Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a si…
题目描述 Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a single rectangular panel with specified w…
题目描述 Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days  clients walked through his door. Each client has ordered a single rectangular panel with specified w…
http://www.lydsy.com/JudgeOnline/problem.php?id=3834 题意:求$max\{(i,j)\}, smin<=i<=smax, wmin<=i<=wmax$,其中$smin<=smax<=10^9, wmin<=wmax<=10^9$,有$N<=1000$组数据 #include <bits/stdc++.h> using namespace std; int main() { int cs,…
问题相当于找到一个最大的k满足在$[x_1,x_2]$,$[y_1,y_2]$中都有k的倍数 等价于$\frac{x_2}{k}>\frac{x_1-1}{k}$且$\frac{y_2}{k}>\frac{y_1-1}{k}$ 注意到这只有$O(\sqrt{n})$种取值,于是可以分段计算,做到$O(\sqrt{n})$每次询问 #include<cstdio> int T,a,b,c,d,i,j,t; inline void up(int&a,int b){if(a>…
题目链接 BZOJ3834 题解 容易想到对于\(gcd(x,y) = D\),\(d\)的倍数一定存在于两个区间中 换言之 \[\lfloor \frac{a - 1}{D} \rfloor < \lfloor \frac{b}{D} \rfloor\] \[\lfloor \frac{c - 1}{D} \rfloor < \lfloor \frac{d}{D} \rfloor\] 整除分块即可做到\(O(n\sqrt{max\{b\}})\) #include<algorithm&…
题目大意: $T(T\le1000)$组询问,每次给出$A,B,C,D(A,B,C,D\le10^9)$,求满足$A\le x\le B,C\le y\le D$的最大的$\gcd(x,y)$. 思路: 令$n=\gcd(x,y)$,则若$n$为合法的答案,当且仅当$\lfloor\frac{A-1}n\rfloor<\lfloor\frac Bn\rfloor,\lfloor\frac{C-1}n\rfloor<\lfloor\frac Dn\rfloor$. 考虑数论分块,每次用块内最大值…
首先旋转坐标系,将范围表示成矩形或者射线 如果范围是一条线,则将灯按y坐标排序,y坐标相同的按x坐标排序, 对于y相同的灯,f[i]=min(i,它前面灯发光时刻的第k[i]小值), 线段树维护,$O(n\log n)$ 如果范围是一个矩形,则将灯按x坐标排序,x坐标相同的按y坐标排序, 从左往右.从下到上依次扫描,f[i]=min(i,它左下角灯发光时刻的第k[i]小值), 权值线段树套SBT维护,$O(n\log^2n)$ #include<cstdio> #include<algo…
整除分块枚举... 真的没有想到会这么简单. 要使一个数 \(p\) 满足 条件, 则 存在\(x, y\), \(a<=x \times p<=b\ \&\&\ c<=y \times p <=d\) 把\(p\) 除掉 则 \(\left\lceil\dfrac{a}{p}\right\rceil <=y <=\left\lfloor\dfrac{b}{p}\right\rfloor\) \(\left\lceil\dfrac{c}{p}\right…