2020 Summer Training WEEK1

tags: Music

Training work:

The first week, basically 8: 00-11: 00, 14:00 - 18:00, 19:00 - 22:00


Training content:

Mainly, training 5 games, 4 cf, a cow


Recommended topic:

E2. Asterism (Hard Version)

Topic address:https://codeforces.com/contest/1371/problem/E2
This question can go to see the inscription, I also see the official question solvinghttps://codeforces.com/blog/entry/79624
First understand this formula

wherein BI indicates a number of times the entire sequence is less than the number equal to I.
When we choose the first number, it must be less than or equal to the number equal to X, that is, Bx
The second number, must be less than or equal to X + 1, ie Bx+1But the previous choosed a number, so only Bx+1 - 1 kind
Pushing in this class, can be available

Set max as the maximum of the entire sequence
x + n 1 < m a x x+n-1<max At the time, the maximum of the largest, there is no sequence, definitely can't, that is, f (x) = 0, not satisfied
x m a x x\geq max When you choose, you can choose, you can f (x) = n!
Other situations are m a x n + 1 x < m a x max-n+1 \leq x<max
We only need to meet

The range does not exceed 2E5, so we can record i-b directlyiValue, then directly map

int n,m;
char str[N];
int f[N];
unordered_map<int,int> mm;
int main()
{
    rr(n,m);
    FOR(i,1,n){
        r(f[i]);
    }
    sort(f+1,f+n+1);
    FOR(i,f[n]-n+1,f[n]+n-2){
        mm[i]=(i%m-(upper_bound(f+1,f+n+1,i)-f-1)%m+m)%m;
    }
    unordered_map<int,int> mmm;
    int st=max(0,f[n]-n+1);
    FOR(i,1,n-1){
        int now=st+i-1;
        mmm[mm[now]]++;
    }
    vector<int> ans;
    FOR(i,st,f[n]-1){
        mmm[mm[i+n-1]]++;
        if(mmm.count(i%m)&&mmm[i%m]>0){
//            cout<<i<<endl;
        }
        else{
            ans.pb(i);
        }
        mmm[mm[i]]--;
    }
    cout<<ans.size()<<endl;
    for(int x:ans){
        cout<<x<<' ';
    }
    cout<<endl;
    return 0;
}

Intelligent Recommendation

HGAME 2020 week1

Web Cosmos blog 1. Look at the prompt to find the source code of this website on GitHub, search Cosmos Hgame to find it, click 3 commits, click new file, and you can see: base64 decoding: aGdhbWV7ZzF0...

2020 Niu Jing Summer Summer Multi-school Training Fourth Summary

2020 Niu Jing Summer Summer Multi-school Training Fourth Summary About the competition: This question is much more difficult than the topic of the third game. Mainly doing less). The sign-in question ...

2020 Niki Summer Summer Multi-school Training Ninth Sign

2020 Niki Summer Summer Multi-school Training Ninth Sign A Groundhog and 2-Power Representation Topic Description: In fact, it is given a computing EMMM parentheses expression method? such as 137 = 2 ...

Coding training-week1 (4.29-5.5)

Current title set:Niuke.com Huawei machine test Programming environment: sublime text3 + vmware ubuntu + xshell Programming Language: C Article directory String related Question 1 The last word length...

2020 Niuke Summer Multi-School Training Camp (Second Session) G

Title: Given two arrays A and B, find a sub-array C in A such that C i>=B i, ∀i∈[1,m] There are several sub-arrays General idea: sort the A and B arrays in descending order, and save th...

More Recommendation

2020 Niuke Summer Multi-School Training Camp (Second Session) B

Question meaning: gives you n points, let you define the center of the circle (the center is not required to be one of the n points) and the radius, and require as many points as possible in the circl...

2020 Niuke Summer Multi-School Training Camp (Second Session)

E. Exclusive OR Question meaning: give you an array a of length n, find the largest XOR sum of one, the largest XOR sum of two, the largest XOR sum of three, ..., the largest XOR sum of n , Each ...

2020 Niuke Summer Multi-School Training Camp (Second Session) Boundary

Portal:Boundary  Title:Give you the coordinates of n points, and ask how many points can be on the same circle at most, and (0,0) must be on this circle. answer:Three points determine a circle, s...

2020 Niu Ke Summer Vacation Training Camp Supplement (Session 6)

I still can’t fish during summer vacation, try to make up one question every day. Most of the supplementary questions here should refer to the solutions of the big guys, so if a big guy sees his...

2020 Niu Ke Summer Vacation Training Camp Supplement (Session 5)

I still can’t fish during summer vacation, try to make up one question every day. Most of the supplementary questions here should refer to the solutions of the big guys, so if a big guy sees his...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top