Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор yash_daga, история, 30 часов назад, По-английски

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!

  • Проголосовать: нравится
  • +55
  • Проголосовать: не нравится

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

The contest starts in around ~15 minutes.

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

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

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

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

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 ?

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

    It is a standard mathematical problem solved after the contest but i got WA when i took a[0] = 4 and when i chahged it to 2e6 it got AC .....

    Idk in java it gave tle but in C++ it gives Ac

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

    just assume a[0] to be the max element

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

    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

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

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

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

    was an easy observation u should have considered different cases

    • »
      »
      »
      69 минут назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится
      • i got the logic but i don't know how calculate nCx.
      • how to calculate nCx ? , modular operation may not be valid for divisions right?