
二分
文章平均质量分 79
做不完的ACM
加油,努力
展开
-
Wannafly3位数差
题解:先整体考虑可以推出和顺序无关,对于当前i考虑bit(a[i]+a[j])比bit(a[i])大一#include using namespace std;typedef long long ll;const int N = 1E5 + 7;ll bit(ll x){ if(!x) return 1; ll cnt = 0; while(x) {原创 2017-11-15 03:13:24 · 248 阅读 · 0 评论 -
Codeforces915E Physical Education Lessons
题目链接:http://codeforces.com/contest/915/problem/E题意:初始化区间1~N,全为1,N是1E9级别,Q个操作与询问。对于当前询问输出1~N还有多少个1。操作1:把L-R这段区间全变0操作2:吧L-R这段区间全变1题解:把区间左右端点暴力存在set里, 对于当前l,r在set里二分下找到第一个在他右边的区间。首先不管K=1还是K=2,都原创 2018-01-15 17:57:01 · 615 阅读 · 0 评论 -
HihoCoder1084:(二分+HASH)
题目链接:http://hihocoder.com/problemset/problem/1084?sid=1279817题意:你知道KMP吗?它是用于判断一个字符串是否是另一个字符串的子串的算法。今天我们想去扩展它。在信息理论中,在两个相同长度的字符串之间的海明码距离是:两个字符串相同位置对应的字符不同的位置数目。换种说法,它表示将一个字符串转化为另一个字符串所需要改变字符的最小数目。下面这些字...原创 2018-03-08 22:38:06 · 239 阅读 · 0 评论 -
Codeforces 957C二分
题目链接:http://codeforces.com/problemset/problem/957/CC. Three-level Lasertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn atom of element X can exi...原创 2018-03-27 12:16:59 · 511 阅读 · 0 评论 -
二分 Walking in the Forest
链接:https://www.nowcoder.com/acm/contest/106/K来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST. Now you're going to walk through a large forest. There is ...原创 2018-04-30 19:59:05 · 147 阅读 · 0 评论 -
Codeforces 939E(三分)
E. Maximize!time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a multiset S consisting of positive integers (initially empty). There ar...原创 2018-04-25 01:46:29 · 380 阅读 · 0 评论 -
Codeforces 965D
题目链接:http://codeforces.com/contest/965/problem/DA lot of frogs want to cross a river. A river is w units width, but frogs can only jump l units long, where l<w. Frogs can also jump on lengths short...原创 2018-04-26 23:27:19 · 359 阅读 · 0 评论 -
Codeforces985D
思路:二分,.有以下两种构造,分别计算两种情况取个最小。#include <bits/stdc++.h>using namespace std;using ll = long long ;ll n, H;bool check1(ll t){ ll cnt = 0; if(t <= H) cnt = t * (t + 1) / 2; else c...原创 2018-05-24 22:34:22 · 230 阅读 · 0 评论 -
Codeforces 1006F Xor-Paths
题目链接:http://codeforces.com/contest/1006/problem/F题面:F. Xor-Pathstime limit per test3 secondsmemory limit per test 256 megabytesThere is a rectangular grid of size n×mn×m. Each cell has a num...原创 2018-07-17 09:51:01 · 388 阅读 · 0 评论