
二分法
二分法
七九河开
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Dreamoon and NightMarket Gym - 101234G (二分答案)
题目 https://vjudge.net/problem/Gym-101234G 题意 给你n个数,为你这n个数组成的集合中和第k小的是多少 思路 二分答案 #include <bits/stdc++.h> using namespace std; const int maxn = 2e5+100; const int maxm = 1e6+100; int a[ma...原创 2019-10-29 16:43:22 · 333 阅读 · 0 评论 -
雀士分组 (校赛 二分图+二分)
题目 http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Index/problemdetail/pid/4532.html 题意 给你n个点 分成两组 让max(碰精队max - 碰精队min, 杠精队max - 杠精队min) 的值 最小 思路 二分图染色缩点 将矛盾的点分为两个线段 找到所有点最大和最小 如果是同一个线段 差即答案...原创 2019-05-29 21:34:30 · 181 阅读 · 0 评论 -
Ice Cream Tower Gym - 101194D (二分)
https://cn.vjudge.net/problem/Gym-101194D #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[300005]; int q,n,k; int vis[300005]; int id[300005]; bool f(ll x) { for(;...原创 2018-12-25 17:31:58 · 207 阅读 · 0 评论 -
Fibonacci Sequence URAL - 1133 (二分)
题目 https://cn.vjudge.net/problem/URAL-1133 题意 给你斐波那契数的某两项,求第n项 思路 暴力二分给的下标小的的第二项 用另一个验证 #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[10000]; ll x1,x2,x3,y1,y2; i...原创 2018-12-11 15:29:57 · 159 阅读 · 0 评论 -
Preparing for Merge Sort CodeForces - 847B
Ivan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or several increasing ...原创 2018-12-04 14:44:51 · 160 阅读 · 0 评论 -
Colonial Mansions Gym - 101962I (线段树+二分)
After a year of hard work, Mano finally had a month off. He decided to take his grandmother to Soteropolis during this time. As soon as they arrived at the airport, Mano bought one of these "10 things...原创 2018-11-02 15:24:45 · 374 阅读 · 0 评论 -
二分法 模板
while(l+1<r) { mid = (l+r)>>1; if(ok(m)) l = m; else r = m; } if(ok(r)) printf("%d \n",r); else printf("%d \n",l); 二分查找(百度百科) #include<iostr...原创 2018-08-28 20:02:21 · 439 阅读 · 0 评论 -
Squirrel and chestnut CodeChef - SQUIRREL
There are n squirrel(s) waiting below the feet of m chestnut tree(s). The first chestnut of the i-th tree will fall right after Ti second(s), and one more every Pisecond(s) after that. The “big mama” ...原创 2018-08-28 20:01:18 · 642 阅读 · 0 评论 -
Powers of Two CodeForces - 702B
You are given n integers a1, a2, ..., an. Find the number of pairs of indexes i, j (i < j) that ai + aj is a power of 2 (i. e. some integer x exists so that ai + aj = 2x). Input T...原创 2018-06-05 19:38:11 · 257 阅读 · 0 评论 -
上色的纱雾 oj
上色的纱雾 Time Limit: 1000MSMemory Limit: 65536KB Problem Description 纱雾画画功力首屈一指,现在她准备上色了,这时候她在想,怎样上色的时间最短呢? 在这里我们把问题简化,平面图抽象成坐标轴,需要上色的地方抽象成 n 个点,纱雾有 m 支画笔。 开始的时候纱雾可以选择让画笔落在坐标轴任意一原创 2018-01-29 08:22:03 · 553 阅读 · 0 评论