Codechef Starters 141 | Video Solutions - A to D | by Abhinav Kumar | TLE Eliminators

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ก.ค. 2024
  • Here are the video solutions in the form of a post-contest discussion for problems A, B, C, D of Codechef Starters 141 (Div 2). The live discussion was done with students of TLE Eliminators, this is the recording of the same. We hope this will be useful for you in up-solving this contest.
    📢Check out handpicked problems by Priyansh himself, on our CP-31 sheet: www.tle-eliminators.com/cp-sheet
    Solution Codes:
    Problem A: www.codechef.com/viewsolution...
    Problem B: www.codechef.com/viewsolution...
    Problem C: www.codechef.com/viewsolution...
    Problem D: www.codechef.com/viewsolution...
    Be sure to check out TLE Eliminators.
    Website: www.tle-eliminators.com/
    Instagram: / tle_eliminators
    Linkedin: / tle-eliminators
    Twitter: / tle_eliminators
    TLE Community Discord Server: / discord
    Timestamps:-
    0:00 Problem A
    14:54 Problem B
    43:00 Problem C
    1:21:30 Problem D

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

  • @TLE_Eliminators
    @TLE_Eliminators  8 วันที่ผ่านมา

    Please fill the feedback form: forms.gle/WdVAj6WUKMxkSbXF6

  • @c-fn5jv
    @c-fn5jv 8 วันที่ผ่านมา +5

    For problem C you can compute initial beauty in O(n) using pref sum

  • @39_jatinjain4
    @39_jatinjain4 7 วันที่ผ่านมา +2

    Great Explanation

  • @adarshamit7860
    @adarshamit7860 7 วันที่ผ่านมา +3

    i was able to do 2 of them... thanks for the explanation , it helps us upsolve our contests.

  • @pratyushdubey5362
    @pratyushdubey5362 8 วันที่ผ่านมา +3

    Great explanation thanks alot to the TLE team 🙌.

  • @VivekYadav-uy9ts
    @VivekYadav-uy9ts 7 วันที่ผ่านมา +1

    Thnx for the explanations bro, they were great!

  • @bishwathakur3600
    @bishwathakur3600 8 วันที่ผ่านมา +1

    Lovely explanation sir🔥🔥🔥

  • @nightfury6096
    @nightfury6096 7 วันที่ผ่านมา +1

    great explanation💯

  • @NIKHIL-wh1qh
    @NIKHIL-wh1qh 7 วันที่ผ่านมา

    There is no need to use set we can check beauty by prefix sum if it is equal to i*(i+1)/2 or sum-arr[i]+arr[i+1] is equal to i*(i+1)/2 . This approach will solve the question in O(n) for question. 3

  • @user-qq5bb7bh5z
    @user-qq5bb7bh5z 7 วันที่ผ่านมา +1

    b and c explanation was so goood!!

    • @garvsharma1210
      @garvsharma1210 7 วันที่ผ่านมา

      kuch bhi , b m formula kse aaya btaya hi nahi !!

  • @deepanshuchawla6493
    @deepanshuchawla6493 7 วันที่ผ่านมา

    July batch kab launch hoga?

  • @pushkarraj4640
    @pushkarraj4640 7 วันที่ผ่านมา

    In C why initial beauty + mx is the ans ? While swapping element in any subarray to get mx wouldn't the initial beauty will also get affected?

    • @VivekYadav-uy9ts
      @VivekYadav-uy9ts 7 วันที่ผ่านมา +1

      No, becuz we are also taking negative one (-1) in cosideration from 'vec' while finding 'mx' that's why the change you're talking about will also get counted while finding the 'mx' itself!

  • @yashmondal7125
    @yashmondal7125 8 วันที่ผ่านมา +1

    The code for the second problem is not working : third output is coming in negative .... Can you provide the correct code !!

    • @abhinavkumariitism
      @abhinavkumariitism 7 วันที่ผ่านมา +1

      Use "long long"
      I have defined my int as long long, that's y its working.

    • @Tanishq_NITian
      @Tanishq_NITian 7 วันที่ผ่านมา

      #include
      using namespace std;
      typedef long long ll;
      const int MOD = 1e9 + 7;
      typedef vector vi;
      typedef vector vll;
      typedef vector vvi;
      typedef vector vs;
      typedef vector vvs;
      typedef pair pii;
      typedef vector vpii;
      int main()
      {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      int t = 1;
      cin >> t;
      for (int i = 0; i < t; i++)
      {
      ll n, k, h;
      cin >> n >> k >> h;
      ll ans = 0;
      for (ll i = 1; i =h)
      ans += n;
      else
      {

      ll r = (k*a-h)/(k-1);
      if(r>0) ans+=r;

      }
      }
      cout

    • @shobhitsingh8695
      @shobhitsingh8695 7 วันที่ผ่านมา

      i did it with binary search
      #include
      using namespace std;
      #define ll long long int
      bool canEscape(ll A, ll B, ll H, ll K) {
      if (A >= H) return true;
      if (A N >> K >> H;
      ll count = 0;
      ll low = 1;
      ll high = N;
      ll minA = 2;
      while (low

  • @AbhishekKumar-xj5un
    @AbhishekKumar-xj5un 7 วันที่ผ่านมา

    In the first question if the array is [2 2 2 2 2 3 3 3 3 3 3] -> converting all elements to 2 would cost 6*2=12 and converting all elements to 3 would cost 5*3=15 , but instead we can convert all the elements to one and the cost would be 11 but your code would output 12 but the optimal is 11 please have a look.

    • @abhinavkumariitism
      @abhinavkumariitism 7 วันที่ผ่านมา +1

      I have checked *for every x from 1 to n* ,
      so when x=1, we get freq[x]=0, so (n-0)*1 is going to give me the optimal answer of 11 for the test case you mentioned.
      You can look at my code, i run a loop *for(int i=1;i

  • @sourabhbindal774
    @sourabhbindal774 6 วันที่ผ่านมา +1

    Can someone pls tell why this code fails i have checked its the same logic
    #include
    using namespace std;
    typedef long long ll;
    const int dx[] = {1, -1, 0, 0};
    const int dy[] = {0, 0, 1, -1};
    const int mod = 1e9 + 7;
    int main() {
    // your code goes here
    int t;
    cin >> t;
    while(t--){
    int n;
    cin >> n;
    std::vector arr(n);
    vector mp(n+1);
    for(int i=0; i> arr[i];
    mp[arr[i]]++;
    }
    int ans = 1e9;
    for(int i=1; i

    • @abhinavkumariitism
      @abhinavkumariitism 6 วันที่ผ่านมา

      You need to use "long long" instead of int

  • @ravishsingla4454
    @ravishsingla4454 7 วันที่ผ่านมา

    bhai sab kuch bdia h bas network sahi karlo voice bhot break ho rhi