Acd, acd cracked version

Source: Internet
Author: User

Acd, acd cracked version

A sequence composed of n numbers (the range of sequence elements is [0, n]). Obtain the longest prefix j, in this case, any number of i1 <i2 in the prefix j must satisfy any m <= j, the number of times i1 appears in the previous m count> = the number of times i2 appears in the previous m count-k (1 ≤ n ≤ 200 000, 0 ≤ k ≤ 200 000 ).

Question link: http://acdream.info/problem? Pid = 1, 1427

--> If the first prefix j is not satisfied, the prefix after j is not satisfied (because j is not satisfied ).. Therefore, from left to right scanning, compare the minimum number of occurrences of all the numbers I with the number of occurrences of the number currently scanned to see if the conditions are met ..

What do I mean by all numbers? Is it a number that has already appeared? Example 2: No .. Is it not greater than the maximum integer currently used? WA told me no .. All non-negative integers <= a [j ..

The minimum number of occurrences of all numbers I. I thought of RMQ and the line segment tree, and finally chose the line segment tree to maintain this minimum value ..

#include <cstdio>#include <cstring>#include <algorithm>#define lc (o << 1)#define rc ((o << 1) | 1)using std::min;using std::max;const int MAXN = 200000 + 10;const int INF = 0x3f3f3f3f;int n, k, Max;int minv[MAXN << 2], cnt[MAXN];int a[MAXN];void Read(){    Max = -1;    for (int i = 1; i <= n; ++i)    {        scanf("%d", a + i);        ++a[i];        if (a[i] > Max)        {            Max = a[i];        }    }}void Build(int o, int L, int R){    minv[o] = 0;    if (L == R) return;    int M = (L + R) >> 1;    Build(lc, L, M);    Build(rc, M + 1, R);}void Update(int o, int L, int R, int q){    if (L == R)    {        minv[o] = cnt[q];        return;    }    int M = (L + R) >> 1;    if (q <= M) Update(lc, L, M, q);    else Update(rc, M + 1, R, q);    minv[o] = min(minv[lc], minv[rc]);}int Query(int o, int L, int R, int ql, int qr){    if (ql <= L && R <= qr)    {        return minv[o];    }    int ret = INF;    int M = (L + R) >> 1;    if (ql <= M) ret = min(ret, Query(lc, L, M, ql, qr));    if (qr > M) ret= min(ret, Query(rc, M + 1, R, ql, qr));    return ret;}void Solve(){    int i;    memset(cnt, 0, sizeof(cnt));    for (i = 1; i <= n; ++i)    {        ++cnt[a[i]];        Update(1, 1, Max, a[i]);        if (Query(1, 1, Max, 1, a[i]) < cnt[a[i]] - k) break;    }    printf("%d\n", i - 1);}int main(){    while (scanf("%d%d", &n, &k) == 2)    {        Read();        Build(1, 1, Max);        Solve();    }    return 0;}



What software is ACDSee?

Software name: ACDsee 7 Simplified Chinese edition
Size: 24 M
Software introduction:
ACDSee is currently the most popular digital image processing software. It can be widely used in image acquisition, management, browsing, optimization, and even sharing with others! With ACDSee, You can efficiently retrieve images from digital cameras and scanners and conveniently search, organize, and preview images. More than 50 common multimedia formats are exhausted by the internet! As the most important image-watching software, it can quickly and high-quality display of your images, coupled with a built-in audio player, we can enjoy the highlights of its slides. Acdsee can also process frequently used video files such as Mpeg. In addition, ACDSee is your most handy image editing tool that allows you to easily process digital images and provides features such as redeye removal, image cutting, sharpening, relief effects, exposure adjustment, rotation, and image editing, batch Processing is also available!
Download oak tree: www1.xiangshu.com/download/software/33.ra

What software is ACDSee?

Software name: ACDsee 7 Simplified Chinese edition
Size: 24 M
Software introduction:
ACDSee is currently the most popular digital image processing software. It can be widely used in image acquisition, management, browsing, optimization, and even sharing with others! With ACDSee, You can efficiently retrieve images from digital cameras and scanners and conveniently search, organize, and preview images. More than 50 common multimedia formats are exhausted by the internet! As the most important image-watching software, it can quickly and high-quality display of your images, coupled with a built-in audio player, we can enjoy the highlights of its slides. Acdsee can also process frequently used video files such as Mpeg. In addition, ACDSee is your most handy image editing tool that allows you to easily process digital images and provides features such as redeye removal, image cutting, sharpening, relief effects, exposure adjustment, rotation, and image editing, batch Processing is also available!
Download oak tree: www1.xiangshu.com/download/software/33.ra

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.