aryanc403
aryanc403
  • 101
  • 235 285
How to bruteforce game theory problems using CF Edu problem
This is a clip from my post contest discussion stream for codeforces education round 169.
I'm adding it as a separate video so that I can refer people to this video whenever a new problems comes up.
Codeforces problem - codeforces.com/contest/2004/problem/E
ABC368F is another such problems which requires only bruteforce.
atcoder.jp/contests/abc368/tasks/abc368_f
Also checkout ""Winning Ways for Your Mathematical Plays V1"" book for more examples of nim games.
Переглядів: 1 348

Відео

Codeforces Educational Round 169 Solution Discussion | ABCDEF
Переглядів 2,4 тис.21 день тому
Codeforces Educational Round 169 Solution Discussion | ABCDEF My submissions - codeforces.com/submissions/aryanc403/contest/2004 Community discord server - discord.gg/HKFgRWmWNY LinkedIn - www.linkedin.com/in/yt403 Twitter - aryanc403 Chapters - 00:00:00 Testing 00:02:20 A. Closest Point 00:13:30 B. Game with Doors 00:26:00 C. Splitting Items 00:36:00 D. Colored Portals 00:50:00 E. ...
How to install atcoder library
Переглядів 1,7 тис.Місяць тому
My blog - aryanc403.com/blog/installing-atcoder-library/ Community discord server - discord.gg/HKFgRWmWNY LinkedIn - www.linkedin.com/in/yt403 Twitter - aryanc403 Tags - #icpc #ioi #codeforces #codeforcessolution #codeforcessolutions #codechef #codechefsolution #codechefsolutiontoday #atcoder #geekforgeeks #topcoder#hackerearth #hackerrank #hackerranksolution #hackerranksolutions #l...
TheOneYouWant AMA
Переглядів 7 тис.4 місяці тому
TheOneYouWant AMA
TheOneYouWant AMA Trailer
Переглядів 3,6 тис.4 місяці тому
TheOneYouWant AMA Trailer
#Atcoder #ABC 345 "E - Colorful Subsequence" Editorial (By #AIR #1)
Переглядів 9575 місяців тому
#Atcoder #ABC 345 "E - Colorful Subsequence" Editorial (By #AIR #1)
#Codeforces round 930 "Bitwise Operation Wizard" Editorial
Переглядів 1,2 тис.6 місяців тому
#Codeforces round 930 "Bitwise Operation Wizard" Editorial
#Codeforces round 930 "Shuffle Party" Editorial
Переглядів 1,2 тис.6 місяців тому
#Codeforces round 930 "Shuffle Party" Editorial
#Codeforces round 930 "Pokémon Arena" Editorial
Переглядів 5586 місяців тому
#Codeforces round 930 "Pokémon Arena" Editorial
#Codeforces think-cell round 1 C. "Lexicographically Largest" editorial
Переглядів 2,5 тис.6 місяців тому
#Codeforces think-cell round 1 C. "Lexicographically Largest" editorial
#Codeforces think-cell round 1 A. "Maximise The Score" editorial
Переглядів 3446 місяців тому
#Codeforces think-cell round 1 A. "Maximise The Score" editorial
#Codeforces think-cell round 1 B. "Permutation Printing" editorial
Переглядів 1,1 тис.6 місяців тому
#Codeforces think-cell round 1 B. "Permutation Printing" editorial
#StopPostContestHacking How to play cat and mouse game ft leetcode contests (and a shadow ban)
Переглядів 7226 місяців тому
#StopPostContestHacking How to play cat and mouse game ft leetcode contests (and a shadow ban)

КОМЕНТАРІ

  • @MrGameface123
    @MrGameface123 День тому

    You're doing an amazing job. Keep up the great work

  • @shreyxnsh.14
    @shreyxnsh.14 2 дні тому

    That solution for E was great!

  • @bharatmalhotra1880
    @bharatmalhotra1880 3 дні тому

    leetcode or codeforces

  • @Najir581
    @Najir581 3 дні тому

    Everything is really good explaination but I can not understand the H question .. is there anyone who can help me out from that

  • @ashishchokhani9084
    @ashishchokhani9084 3 дні тому

    In last question, why did u initialize l for binary search=-1 instead of 0 as median>=0. I wasn't getting right answer with l=0. Thanks for the explanation btw !!

  • @codingdude8718
    @codingdude8718 3 дні тому

    thanks alot bro I get really good approach from your channel

  • @mankeshdhanawat5613
    @mankeshdhanawat5613 3 дні тому

    1:05:27 this mint (atcoder library) allowed in ICPC or not (also on codechef and leetcode as well)

  • @danushbasanaboyina1306
    @danushbasanaboyina1306 4 дні тому

    Bro I started attempting codeforces, after watching your videos.thank you for your such a nice explanation.

  • @Mark-vv8by
    @Mark-vv8by 4 дні тому

    I still don't understand the 3rd case in problem F. how did expected value of 1 2 3 4 5 became 500000012 ?

    • @SHUBHAM-ru7lk
      @SHUBHAM-ru7lk 4 дні тому

      For that you have to study what modulo inverse is and how does it works. For that test case answer would be 17/2 and in question it was stated that if your answer is in fraction (p/q form) the you have to print value of p * q-¹ where q-¹ is modulo of q so answer would be 17 * 2-¹ = 50000012

    • @aryanc403
      @aryanc403 4 дні тому

      The answer is 85/10. The problem statement asks us to print a integer 0<=X<mod, such that (10*X) % mod = 85. 500000012 is the integer between [0,mod-1] such that if we multiply it by 10 and take mod, we will get 85. How to find such integers for other fractions? Checkout modular arithmetic section here usaco.guide/gold/modular

  • @KNR_06_10
    @KNR_06_10 4 дні тому

    Sir if possible can u pls explain java code too..

    • @akshattheintrovert3153
      @akshattheintrovert3153 3 дні тому

      honestly logic is enough if you code in any language. btw i also do cp in java

  • @sourabhtiwari4788
    @sourabhtiwari4788 4 дні тому

    Your stream is mostly watched by 1200 below rated coders, it would really help if you start your solution by first explaining a test case and then doing a dry run over your solution that would really be helpful and please go a bit slow for questions after d(e,f,g...) for div3 and after b(c,d...) in div2, you just need to understand why is your stream not watched by enough even after so many newbies in the contest something needs to change in your style otherwise blatantly giving out solution won't help and your channel would remain stagnant.

    • @aryanc403
      @aryanc403 4 дні тому

      Thank you for the feedback. I will try doing better.

    • @Kartikey30
      @Kartikey30 4 дні тому

      @@aryanc403 sir how u proof ur solution in contest?

    • @sourabhtiwari4788
      @sourabhtiwari4788 3 дні тому

      @@aryanc403 One more suggestion if you could write the code without using the templates that you use in the code(that is like instead of using vi for vector<int> use the whole) that can improve the understanding of the code for the people who are watching your stream for the first time.

    • @sagnikbiswas3268
      @sagnikbiswas3268 2 дні тому

      @@sourabhtiwari4788 i feel like implementation should be done entirely on your own, his code can serve as a reference here and there. But if you understand the algorithm, you should be able to code it entirely on your own.

  • @Kartikey30
    @Kartikey30 4 дні тому

    why gcd==0? can't we write? ke whole array GCF ==1 then it's always possible ke array ko ham 0 to n-1 bana sakte

    • @aryanc403
      @aryanc403 4 дні тому

      It was added before there was a change in constraints. We do not need a check for gcd==0.

    • @Kartikey30
      @Kartikey30 4 дні тому

      @@aryanc403 okk now we only need for gcd 1 na ? since it's now a[i]>=1

  • @cegprakash
    @cegprakash 4 дні тому

    For problem E I didn't attempted because I thought O(t x 26 x n) will timeout as t is too high

    • @aryanc403
      @aryanc403 4 дні тому

      Problem statement has a line - “sum of n over all testcases is .....” With t*n you are essentially computing the same thing. So you can replace t*n with 2e5 and overall time complexity becomes 2e5*26

  • @Mohitkumar-zz4mp
    @Mohitkumar-zz4mp 4 дні тому

    to be honest jis level pe app ho , apka minimum 1m subs hone chahiye , but ye duniya , kya karein bhaiya , acche log ka kadar hi nhi hai , faltu content me million , billion view aate hai

  • @vaibhavyadav1787
    @vaibhavyadav1787 4 дні тому

    where is error in this code void func(){ int a, b; cin>>a>>b; if(a&1){ no; return; } a/=2; if(b<=a){ yes; }else if(b>a){ b = abs(b-a); if((b&1)==0) yes; else no; }else no; }

    • @sarthak9932
      @sarthak9932 4 дні тому

      I wrote the same code dude

    • @vaibhavyadav1787
      @vaibhavyadav1787 4 дні тому

      @@sarthak9932 still getting failed testcase in 2

    • @zebra-er6xc
      @zebra-er6xc 4 дні тому

      why are you doing b = abs(b-a) and comparing a and b values, thodi intuition explain karo

    • @mranonymous8498
      @mranonymous8498 4 дні тому

      A=4, B=8

    • @cegprakash
      @cegprakash 4 дні тому

      A=2 B=4. Your code returns no as 4-2/2 = 3 which is odd. However 1 - 2 + 2 - 2 + 2 - 1 is possible. The problem is you never considered the case where 1 and 1 can simply cancel out each other (without having to depend on 2s) Your code fails for any even b>= 2*a when a is a oddx2 For example your code fails on a=6 b=12 too

  • @ashishchokhani9084
    @ashishchokhani9084 5 днів тому

    Can the last problem be also solved using small to large merging? Thanks for wonderful explanation !

    • @aryanc403
      @aryanc403 4 дні тому

      Maybe one can, but the problem does not need anything more than single dfs.

  • @rengoku448
    @rengoku448 5 днів тому

    That thumbnail picture looks really nice👏👏

  • @L_Yassine
    @L_Yassine 5 днів тому

    thanks for the valuable content !

    • @safetwat
      @safetwat 5 днів тому

      for real, i have seen people discussing post contest but this man is just too good with it, his thought process and explanation is just sublime.

  • @rachakondaeshwar4129
    @rachakondaeshwar4129 5 днів тому

    congrats\\\\\\\\\\\\\\\\\

  • @zebra-er6xc
    @zebra-er6xc 5 днів тому

    Aryan level on cf when?

  • @arpitkumarmishra6220
    @arpitkumarmishra6220 5 днів тому

    your new subscriber

  • @SpiritualMaster-gx6lu
    @SpiritualMaster-gx6lu 7 днів тому

    Leetcode contest winner💥

  • @dfdga34gfd
    @dfdga34gfd 7 днів тому

    can you do abc367 also?

  • @RastyRocky
    @RastyRocky 8 днів тому

    Can you please make a video on selecting problems for practicing and which resources do you use learn for learning topics?

  • @rishabhnegi1937
    @rishabhnegi1937 9 днів тому

    Worst explanation

  • @grandparick3176
    @grandparick3176 9 днів тому

    In problem D1, it says you start with some element X but what exactly is that X? We don't really take anything X as input so how do we exactly guess what x to take?

  • @laxmanchoudhary4450
    @laxmanchoudhary4450 10 днів тому

    please explain what you have written in contest do not code a new code while explaining it creates problem in understanding the code

  • @jaadu2551
    @jaadu2551 10 днів тому

    Need a video on parallel binary search

  • @kz_cbble9670
    @kz_cbble9670 11 днів тому

    Thanks for codeforces. Can you also do this for atcoder?

    • @aryanc403
      @aryanc403 11 днів тому

      ua-cam.com/play/PLY4qyBz7rQ86kKUmXmAcr8_FUyGIy7iJ2.html

    • @shreyxnsh.14
      @shreyxnsh.14 8 днів тому

      @@aryanc403 Please do this for every Atcoder Beginner

  • @KuldeepSingh-yo7sh
    @KuldeepSingh-yo7sh 11 днів тому

    sir D1 wala bilkul smjh mai nhi aya

    • @faiazmahmud6277
      @faiazmahmud6277 11 днів тому

      u can ask me in cf id i can explain u there

  • @shivapandey8510
    @shivapandey8510 11 днів тому

    In question C, we can store the characters along with their frequency without sorting and then keep popping the front element for one time and then the other element. This continues while size of q is greater than 1 and at last we can pop the last character. #include <bits/stdc++.h> using namespace std; #define ll long long int #define pp pair<int,char> int main() { ll t; cin>>t; while(t--) { ll n; cin>>n; string s; cin>>s; unordered_map<char,int> mp; for(auto &x : s) mp[x]++; queue<pp> pq; for(auto &x: mp) pq.push({x.second, x.first}); string st=""; while(pq.size()>1) { auto tp= pq.front(); pq.pop(); st.push_back(tp.second); if(tp.first-1>0) { auto tp1 = pq.front(); pq.pop(); st.push_back(tp1.second); pq.push({tp.first-1,tp.second}); if(tp1.first>1) pq.push({tp1.first-1,tp1.second}); } } if(pq.size()) { auto tp = pq.front(); pq.pop(); for(int i=0;i<tp.first;i++) st.push_back(tp.second); } cout<<st<<endl; } } This also shows accepted.

    • @aryanc403
      @aryanc403 11 днів тому

      Yes this is another correct solution. Official editorial has this solution and a reason why it works. codeforces.com/blog/entry/132953

  • @vyomgoyal3125
    @vyomgoyal3125 11 днів тому

    bhai yeh aapke baal pure white kaise ho gaye ek dum se ?

  • @divaspathak8857
    @divaspathak8857 11 днів тому

    Sir can you please continue doing this for upcoming codeforces contest as well?

    • @aryanc403
      @aryanc403 11 днів тому

      I do this for almost every contest. :)

  • @csbotlol
    @csbotlol 11 днів тому

    In google OA there was a question in which given a tree we needed to find sum of medians of all odd length path of the tree.. i tried solving it using ordered set but got TLE.. tips on how to solve it

  • @vineetsingh4707
    @vineetsingh4707 11 днів тому

    Can someone suggest me like it took me almost 1 hour to hit the approach for the second one.

  • @AnkitSingh-ex6ib
    @AnkitSingh-ex6ib 11 днів тому

    Number of question solve by you in today contest can send someone to depression 😢 but motivating at same time

  • @padhai_karle_bhai
    @padhai_karle_bhai 11 днів тому

    Thanks a lot for this .

  • @shreyanray7624
    @shreyanray7624 11 днів тому

    congratulations! nice performance today

  • @hkrai1372
    @hkrai1372 12 днів тому

    Will u Atcoder regular contest solution?

  • @frouMagician
    @frouMagician 12 днів тому

    didnt know pedro pascal started cp

  • @llarn.i5103
    @llarn.i5103 12 днів тому

    Amazing thank you so much

  • @zebra-er6xc
    @zebra-er6xc 12 днів тому

    C: 8:30

  • @prantobala8505
    @prantobala8505 12 днів тому

    plz add subtitle for better understanding.

    • @Study_With_Sachin
      @Study_With_Sachin 12 днів тому

      bro this is live stream how he can add subtitles . #aryan sir orz

  • @prantobala8505
    @prantobala8505 12 днів тому

    don't stop bro. Love from Bangladesh!

  • @user-xk6ob5eb8t
    @user-xk6ob5eb8t 13 днів тому

    useful video,hope u do more vid like this

  • @kshitijtakarkhede7833
    @kshitijtakarkhede7833 14 днів тому

    Sir , can you explain distance colour problem , why we divide grid into k*k grids in n*m grid problem of codeforces

  • @ronakjain8164
    @ronakjain8164 14 днів тому

    I was trying G1 using binary search. But for checking if the division is possible. I was doing like consider that length is mid. So first mid character should be same. Now to count the number of subarrays which can have the common prefix of mid length I was doing something like int j = 0; int cnt = 0; for(int i = 0; i < n;i++){ if(s[i] == s[j]){ j++; if(j == mid){ cnt++; j = 0; } }else{ if(s[i] == s[0]){ j = 1; }else{ j = 0; } } } I have a pointer j which is telling which character to compare.. and when it reaches mid it means we have got one substring with the prefix and increase cnt. But I don't know why Is it giving wrong answer on test 3. Can you please help me out on this ? codeforces.com/contest/1968/submission/277009975

  • @sohamsanap5065
    @sohamsanap5065 14 днів тому

    Waiting for codechef staters 147 discussion video

  • @shivanshgoel2504
    @shivanshgoel2504 14 днів тому

    Problem E - > Plz compile this code and told me error this give me TLE ON 2ND TEST CASE #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<int> answr; for (int i = 0; i < n; i++) { int a = 0; int b = 0; cin >> a; cin >> b; vector<int> dp(200001, -1); vector<int> prefixsum(200001); for (int i = a; i <= b; i++) { int count = 0; int p = i; while (p) { count++; p /= 3; if (dp[p] != -1) { prefixsum[i] = dp[p]; continue; } } prefixsum[i] = count; dp[i] = count; } for (int i = a + 1; i <= b; i++) { prefixsum[i] += prefixsum[i - 1]; } int ans = prefixsum[a] * 2 + (prefixsum[b] - prefixsum[a]); answr.push_back(ans); } for (int i = 0; i < n; i++) { cout << answr[i]; cout << endl; } return 0; }