hdu-3833 YY's new problem(数组标记)】的更多相关文章

YY's new problem Time Limit: 12000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 5422    Accepted Submission(s): 1522 Problem Description Given a permutation P of 1 to N, YY wants to know whether there exists…
http://acm.hdu.edu.cn/showproblem.php?pid=3833 做这题时是因为我在网上找杭电的数论题然后看到说这道题是数论题就点开看了以下. 然后去杭电上做,暴力,超时了,想了半天还是没啥好办法,到底哪要用到数论的知识呢,想不出还得去搜题解,脑子笨啊. 然后说用hash再报暴力,没看人家代码,然后就顺着这思路写,我写的是当前是a[i];然后j从1到i-1,用2*a[i]-a[j]的另一个数并且这个数的范围为1到N;而且在1到i-1中没出现过 那么必定在i的右侧,这个…
题目链接 用p[a]保存的是输入的a在第p[a]个,  然后根据差值查找. #include<stdio.h> #include<string.h> int main() { ]; scanf("%d",&t); while(t--) { flag=; scanf("%d",&n); ;i<n;i++) { scanf("%d",&a); p[a]=i; } m=n/; ;j<m;j++…
  Time Limit:4000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3833 Description Given a permutation P of 1 to N, YY wants to know whether there exists such three elements P[i1], P[i2], P[i3] that P[i1]-P[i2]…
Dating with girls(2) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2705    Accepted Submission(s): 759 Problem Description If you have solved the problem Dating with girls(1).I think you can s…
Stars Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/65536 K (Java/Others) Total Submission(s): 785    Accepted Submission(s): 335 Problem Description Yifenfei is a romantic guy and he likes to count the stars in the sky. To make the p…
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 42367    Accepted Submission(s): 19198 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j…
hdu 3553 Just a String (后缀数组) 题意:很简单,问一个字符串的第k大的子串是谁. 解题思路:后缀数组.先预处理一遍,把能算的都算出来.将后缀按sa排序,假如我们知道答案在那个区间范围内了(假设为[l,r]),那么我们算下这个区间内的lcp的最小值(设最小值的位置为mid,大小为x),如果x*(r-l+1)>=k,那么,答案就是这个区间的lcp的最小值的某一部分(具体是哪一部分,画个图稍微算下就出来了).如果x * ( r - l + 1 ) < k 那么我们分两种情况…
HDU 4974 A simple water problem pid=4974" target="_blank" style="">题目链接 签到题,非常easy贪心得到答案是(sum + 1) / 2和ai最大值的最大值 代码: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int N =…
HDU 5572 An Easy Physics Problem (计算几何) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5572 Description On an infinite smooth table, there's a big round fixed cylinder and a little ball whose volume can be ignored. Currently the ball stands still at p…