Блог пользователя Dominater069

Автор Dominater069, 2 месяца назад, По-английски

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
  • Проголосовать: нравится
  • +44
  • Проголосовать: не нравится

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
2 месяца назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Dominater round

»
2 месяца назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

C++23 when

»
2 месяца назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

interesting problems!!

»
2 месяца назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

good problems

»
2 месяца назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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;
}
  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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

  • »
    »
    2 месяца назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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 :)

»
2 месяца назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

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

»
2 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Nice problems!