yash_daga's blog

By yash_daga, history, 18 months ago, In English

We invite you to participate in CodeChef’s Starters 155, this Wednesday, 9th October, rated upto 5 stars (i.e. 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.

Good Luck!

  • Vote: I like it
  • +58
  • Vote: I do not like it

| Write comment?
»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

The contest starts in around ~15 minutes.

»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What wrong with this Replace With First's logic ?

#include <bits/stdc++.h>
using namespace std;

int main() {
    int tt;
    cin >> tt;
    
    while (tt--) {
        int n, m;
        cin >> n >> m;
        
        string s, t;
        cin >> s >> t;
        
        if (s == t) {
            cout << 0 << endl;
            continue;
        } else if (s[0] != t[0]) {
            cout << -1 << endl;
            continue;
        } else {
            int flag = 0;
            for (int i = 0; i < min(n, m); i++) {
                if (s[i] != t[i]) {
                    flag = 1;
                    break;
                }
            }
            if (flag == 0) {
                cout << 1 << endl;
            } else {
                cout << 2 << endl;
            }
        }
    }
    return 0;
}
»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

why is in gcd(hard) question, printing matrix with all number as 2 is wrong?

»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I have a question for those who solved problem Div1C (Div2D) Prefix Suffix Min Max ,

How did u figured out the solution ? did u solve almost similar problem before or solved it just now ?

  • »
    »
    18 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    just assume a[0] to be the max element

  • »
    »
    18 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    solved for the first time.

    logic : If the first element is max, then the sum of next elements till i will be b[i]
    
    -> a[1]=b[1], a[2]=b[2]-b[1] .... a[i]=b[i]-b[i-1]
    

    -> a[0]=max(a[1]....a[n-1]) or 2000000

»
18 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

i liked array concatenation (although could not solve in contest)