0可以表示任何1到m的数,求一个最长的连续上升序列长度 因为m的范围在10w,所以以每个节点为起点 进行二分,复杂度mlogm 思路:b[i]表示到 1 到 i 有几个数没有出现,二分的时候注意加等号 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<cstdlib> #include<cmath> #include&l…
Problem 2216 The Longest Straight Accept: 17    Submit: 39Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includin…
Description 题目描述 ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consecutive values. Values do not wrap around, so 1 does not…
题目链接:The Longest Straight 就是一个模拟就是这样,T_T然而当时恶心的敲了好久,敲完就WA了,竟然有这么简单的方法,真是感动哭了.......xintengziji...zhishang... 模拟和暴力也都是有黑科技的.. 附黑科技代码: #include<stdio.h> #include<queue> #include<iostream> #include<string.h> #include<algorithm>…
 Problem 2216 The Longest Straight Accept: 7    Submit: 14 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includi…
 Problem 2216 The Longest Straight Accept: 523    Submit: 1663Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(incl…
 Problem 2216 The Longest Straight Accept: 82    Submit: 203Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(includ…
题目大意:给n个0~m之间的数,如果是0,那么0可以变为任意的一个1~m之间的一个数.从中选出若干个数,使构成一个连续的序列.问能构成的最长序列的长度为多少? 题目分析:枚举连续序列的起点,二分枚举二分序列的终点. 代码如下; # include<iostream> # include<cstdio> # include<queue> # include<vector> # include<list> # include<map> #…
Problem E The Longest Straight Accept: 71    Submit: 293 Time Limit: 1000 mSec    Memory Limit : 32768 KB Problem Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including…
思路:维护一个森林,二分枚举最小的最大值. #include<set> #include<map> #include<cmath> #include<queue> #include<cstdio> #include<vector> #include<string> #include<cstdlib> #include<cstring> #include<iostream> #includ…