Dominater069's blog

By Dominater069, 6 weeks ago, In English

We invite you to participate in CodeChef’s Starters143, this Wednesday, 17th July, rated for till 5-Stars(ie. for users with rating < 2200).

Time: 8:00 PM — 10:00 PM IST

Joining us on the problem setting panel are:

Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest. The video editorials of the problems will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here. Hope to see you participating.

The following is the count of problems in each division :

  • Division 1 : 5 problems
  • Division 2 : 6 problems
  • Division 3 and 4 : 7 problems

Good Luck!

UPD : Congratulations to the top 5!

  1. jeroenodb
  2. kdu_4
  3. maspy
  4. liympanda
  5. Kude
  • Vote: I like it
  • +44
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I see what you've done there, stealing contribution from the contest admin yash_daga! /j

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Dominater069 (previous revision, new revision, compare).

»
6 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

Dominater round

»
6 weeks ago, # |
  Vote: I like it -9 Vote: I do not like it

C++23 when

»
6 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

interesting problems!!

»
6 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

good problems

»
5 weeks ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can someone help me find the bug in my code for Binary Conversion? I can't seem to find what's wrong with the code. A small counterexample would be appreciated.

Edit: nevermind, generated testcases against a correct solution and found the bug

void solve(){
    int n, k;
    cin >> n >> k;
    string s1, s2;
    cin >> s1 >> s2;
    auto temp1 = s1, temp2 = s2;
    sort(temp1.begin(),temp1.end()); sort(temp2.begin(),temp2.end());
    if(temp1!=temp2) {
        cout << "NO" << endl;
        return;
    }
    int dif = 0;
    for(int i = 0; i < n; i++) if(s1[i] != s2[i]) dif++;
    bool ok = true;
    if(n==2) {
        if(s1!=s2 && k%2 ==0) ok = false; 
        else if (s1==s2 && k%2 ==1) ok = false;
        if(ok) cout << "YES" << endl;
        else cout << "NO" << endl;
        return;
        
    }
    if(dif/2 <= k) cout << "YES" << endl;
    else cout << "NO" << endl;
}
  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    ig if you take like this s = 0 0 t = 0 0 here for any value of k>=1 the value will be YES, becoz you can swap adjacent ele any no of times. but your code is giving YES only for even k

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The last TC was for S1==S2 which you have to consider separately. If S1==S2 then if k is even the always possible else if k is odd then length should bhe greater than 2.e.g. 1001 , 1001 both value of k=3 and k=4 will work.This only case wasted my 15 minutes.Hope it helps :)

»
5 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

Can someone tell me how do you solve LEXMINBIN from yesterday's contest? Thanks

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Nice problems!