Codeforces Round 968 (Div. 2) || Editorial for Problem A,B,C,D

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ก.ย. 2024
  • A. Turtle and Good Strings || B. Turtle and Piggy Are Playing a Game 2 || C. Turtle and Good Pairs || D1. Turtle and a MEX Problem (Easy Version)
    contest URL: codeforces.com...
    Contact me:-
    LinkedIn - / swapnil-tayal-53a5b4221
    Instagram - / swapnil_tayal
    #codeforces #cp #cpp #educational #EducationalCodeforces #div2 #codeforcessolutions #editorial #educational #Codeforces968 #968

ความคิดเห็น • 7

  • @kartiknagrale1479
    @kartiknagrale1479 24 วันที่ผ่านมา +1

  • @dewsara2888
    @dewsara2888 22 วันที่ผ่านมา +1

    Thanks a lot for your help

    • @nicspyy
      @nicspyy  22 วันที่ผ่านมา +1

      @@dewsara2888 welcome 😎

  • @sanskargupta5299
    @sanskargupta5299 20 วันที่ผ่านมา +1

    great explanation buddyyyy

    • @nicspyy
      @nicspyy  19 วันที่ผ่านมา +1

      thanks bro❤❤

  • @nicspyy
    @nicspyy  24 วันที่ผ่านมา +1

    C solution:
    void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    map mp;
    for(auto &i: s) mp[i]++;
    priority_queue pq;
    for(auto i: mp){
    pq.push({ i.second, i.first });
    }
    vector a;
    int num = pq.top().first;
    char ch = pq.top().ss;
    pq.pop();
    forn(i,0,num){
    string s;
    s += ch;
    a.pb(s);
    }

    int ind = 0;
    while(!pq.empty()){
    char ch = pq.top().ss;
    int num = pq.top().ff;
    while(num > 0){
    a[ind] += ch;
    num--;
    ind = (ind + 1) % (a.size());
    }
    pq.pop();
    }
    string ans = "";
    for(auto i: a) ans += i;
    cout m;
    int secMex = 0;
    while(x--){
    int n;
    cin>>n;
    set s;
    forn(i,0,n) {
    int x; cin>>x;
    s.insert(x);
    }
    int num = 0;
    int cnt = 0;
    while(cnt < 2){
    if(s.count(num) == 0){
    s.insert(num);
    secMex = max(secMex, num);
    cnt++;
    }
    num++;
    }
    }
    if(m < secMex) {
    int ans = secMex*(m + 1);
    cout

  • @yrulookinghere509
    @yrulookinghere509 24 วันที่ผ่านมา +1

    cf id????