Good Bye 2024: 2025 is NEAR || Editorial for Problem A,B,C,D

Поділитися
Вставка
  • Опубліковано 15 січ 2025

КОМЕНТАРІ • 18

  • @sashibhushanarajput1194
    @sashibhushanarajput1194 14 днів тому +2

    I am the 1000th subscriber. Hope to see more of your content. Keep going buddy !!!

    • @nicspyy
      @nicspyy  14 днів тому +1

      @@sashibhushanarajput1194 🎊🎊🎊🎊🎉🎉🎉🎉 thanks buddy

  • @ananyerawat-m6f
    @ananyerawat-m6f 18 днів тому +2

    6:46 it should be 0110.

  • @mohdkashif9830
    @mohdkashif9830 18 днів тому +1

    thanks a lot bro well explained!!

    • @nicspyy
      @nicspyy  18 днів тому

      @@mohdkashif9830 thanks

  • @kushwanthaddepalli5236
    @kushwanthaddepalli5236 18 днів тому +1

    Nice explanation.
    Thanks bhai!

  • @barman1734
    @barman1734 18 днів тому +1

    How did the formula for C came ???
    Dont call a "reading out" of solution an editorial.

    • @nicspyy
      @nicspyy  18 днів тому +1

      I am not denying that proof is not there, but during contest I saw this pattern, so didn't aimed for finding proof also

  • @theslimeoxidizer3308
    @theslimeoxidizer3308 18 днів тому +1

    brother youre doing really great . how can we perform good in contests

    • @nicspyy
      @nicspyy  18 днів тому +1

      @@theslimeoxidizer3308 it's just "not giving up on a question to early" maybe 🤔

  • @_hacker-rz2pk
    @_hacker-rz2pk 18 днів тому +1

    nice work brother

    • @nicspyy
      @nicspyy  18 днів тому

      @@_hacker-rz2pk thanks

  • @suryxnz
    @suryxnz 18 днів тому +1

    Great explanation brother

    • @nicspyy
      @nicspyy  18 днів тому +1

      @@suryxnz thanks

  • @nicspyy
    @nicspyy  19 днів тому +2

    please see this image for c's case with k==2
    drive.google.com/file/d/1YTUALw1qMOlqAcJeX4855HkIq0pgIqXU/view?usp=sharing
    B solution:
    void solve() {
    int n;
    cin>>n;
    map mp;
    vpp a(n);
    set st;
    forn(i,0,n){
    cin>>a[i].ff;
    cin>>a[i].ss;
    if(a[i].ff == a[i].ss){
    st.insert(a[i].ff);
    mp[a[i].ff]++;
    }
    }
    vi temp (all(st));
    vector ans(n);
    for(int i=0; i 1){
    ans[i] = 0;
    }else{
    ans[i] = 1;
    }
    }else{
    int ind1 = lower_bound(all(temp), a[i].ff) - temp.begin();
    int ind2 = lower_bound(all(temp), a[i].ss) - temp.begin();
    if(ind1 != temp.size() and ind2 != temp.size() and
    temp[ind1] == a[i].ff and temp[ind2] == a[i].ss
    and ind2-ind1+1 == a[i].ss - a[i].ff + 1
    ){
    ans[i] = 0;
    }else{
    ans[i] = 1;
    }
    }
    }
    for(auto i: ans){
    coutk;
    cout q;
    vector v1 , v2;
    for(int i = 0 ; i < n ; i ++ ){
    cin >> a[i];
    v1.pb(a[i]);
    }
    for(int i = 0 ; i < n ; i ++ ){
    cin >> b[i];
    v2.pb(b[i]);
    }
    sort(v1.begin() , v1.end());
    sort(v2.begin() , v2.end());
    map lastA , lastB , cntA , cntB;
    int res = 1;
    for(int i = 0 ; i < n ; i ++ ){
    lastA[v1[i]] = i;
    lastB[v2[i]] = i;
    cntA[v1[i]] ++ ;
    cntB[v2[i]] ++ ;
    res = res * min(v1[i] , v2[i]);
    res = res % mod;
    }
    vector ans;
    ans.pb(res);
    while(q--){
    int type, ind;
    cin>>type>>ind;
    ind-- ;
    if(type == 1){
    int x = a[ind];
    int i = lastA[x];
    cntA[x]--;
    if(cntA[x] == 0) lastA[x] = -1;
    else lastA[x]--;

    res = (res * powmod(min(v1[i] , v2[i]) , mod-2)) % mod;
    v1[i]++;
    a[ind]++;
    cntA[v1[i]]++;
    if(cntA[v1[i]] == 1) lastA[a[ind]] = i;
    res = res*min(v1[i] , v2[i]);
    res %= mod;
    }
    else{
    int x = b[ind];
    int i = lastB[x];
    cntB[x] -- ;
    if(cntB[x] == 0) lastB[x] = 0;
    else lastB[x] -- ;

    res = res * powmod(min(v1[i] , v2[i]) , mod - 2) % mod;
    v2[i]++;
    b[ind]++;
    cntB[v2[i]]++;
    if(cntB[v2[i]] == 1) lastB[b[ind]] = i;
    res = res *min(v1[i] , v2[i]);
    res %= mod;
    }
    ans.pb(res);
    }
    for(auto x : ans) cout