Card Game || Codeforces Educational Round 136 Div2 Problem C - finalbosscardgame.com

Card Game || Codeforces Educational Round 136 Div2 Problem C

Competitive Coding – Newton School
Views: 3448
Like: 147
๐Ÿ”ฅ๐๐š๐ฒ ๐€๐Ÿ๐ญ๐ž๐ซ ๐๐ฅ๐š๐œ๐ž๐ฆ๐ž๐ง๐ญ
Newton School’s ๐…๐ฎ๐ฅ๐ฅ ๐’๐ญ๐š๐œ๐ค ๐‚๐จ๐ฎ๐ซ๐ฌ๐ž ๐Ÿ๐ŸŽ๐Ÿ๐Ÿ –
Newton School Official WhatsApp Support Number: +91 6362 331 200
———————————————————————————–

๐Ÿ“Œ๐“๐ž๐ฅ๐ž๐ ๐ซ๐š๐ฆ:
๐Ÿ“Œ๐‹๐ข๐ง๐ค๐ž๐๐ˆ๐ง: …
๐Ÿ“Œ๐ˆ๐ง๐ฌ๐ญ๐š๐ ๐ซ๐š๐ฆ: …
๐Ÿ“Œ๐…๐š๐œ๐ž๐›๐จ๐จ๐ค:

——– ๐€๐›๐จ๐ฎ๐ญ ๐๐ž๐ฐ๐ญ๐จ๐ง ๐’๐œ๐ก๐จ๐จ๐ฅ ——–
๐Ÿ”ตNEWTON SCHOOL is an online Edtech company providing the highest-rated FULL STACK DEVELOPMENT PROGRAM for professionals, graduates, and women.

๐ŸŒ•NEWTON SCHOOL is your gateway to a high-paying tech career in 6 months with Zero fees till placement, transforming you into a rockstar full-stack developer earning 5-40 Lakh per annum salary. Newton Schoolโ€™s students are already working in more than 150+ top companies of India including Zomato, Unacademy, Deloitte, Nutanix, etc.

๐Ÿ”ตTo watch more videos on programming, Data Structures, Android Development, Data Science, C++, Java, React, subscribe to our channel.

– – – – – – – – – – – – – –
If you’re reading this far down, hello, you look nice today ๐Ÿ™‚

Card Game || Codeforces Educational Round 136 Div2 Problem C

#NewtonSchool #NS #Fullstack #FSD #Datascience #MS #Postgrad #webdeveloper #programming #programmer #programmers #developer #coder #programmingmemes #coders #coding #frontenddeveloper #backenddeveloper #html #softwaredeveloper #hacking #python

34 Comments

  1. why have you done n-1Cn/2 when we have picked nth element for alex so it should be n-1Cn/2 -1

  2. What is the expected rating of this problem?

  3. Thank You very much for the editorial. Full supportโค

  4. can you please upload the editorial of Reset K Edges problem

  5. ๐Ÿ›
    bro wt resource did u use to learn combinatorics topics.

  6. but suppose , borris has the nth card and alex has the ( n – 1 ) th card , and its alex turn . now the question is why would he waste his ( n – 1 )th card knowing that the orther person already has the
    n th card , instead he would try to make borris waste his nth card in the beginning itself by using ( n – 2 )nd or ( n – 3 )rd card and then when his turn comes , so he plays the ( n – 1 )th card and win th e game .
    are they bound to use the maximum card they have ? , is that the exact statement they should have inserted ?

  7. can number of ways alex has the (nth card) cant be equal to n-1 choose (n/2)-1

  8. i was thinking of Bitwise DP, can it be possible with that ?

  9. i have a doubt in my code my code gives ans for <=56 but for 58 and 60 due to mod i think it giving wrong ans??

  10. I got all the observations that you have got, but failed at implementation(taking alex equivalent to boris or viceversa)

  11. Can u suggest some more problems like this.

  12. Great explanation for such a complex question๐Ÿ˜

  13. what is that ncr thing that you did in the code , how can i learn that , is that some efficiient approach to deal with factorial things , thank you sir

  14. idk why but this is failing on n=60

    #include <bits/stdc++.h>

    using namespace std;

    #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    #define int long long

    #define all(x) (x).begin(),(x).end()

    //#define loop(i,n) for(int i=0; i<n ;i++)

    typedef pair<int,int> ppi;

    typedef vector<int> vi;

    typedef vector<vector<int>> vvi;

    // #define mod 998244353

    int fact(int n){

    if(n==0) return 1;

    return n*fact(n-1);

    }

    int c(int n,int r){

    if(n<r) return 0;

    if(r == 0 || r==n) return 1;

    return (fact(n))/fact(n-r) / fact(r);

    }

    void fun(int n , vvi &dp){

    if(n==2) return;

    fun(n-2,dp);

    dp[n][0] = (c(n-1 , n/2) + dp[n-2][1] )% 998244353 ;

    dp[n][1] = ( c(n-2 , n/2) + dp[n-2][0])% 998244353;

    dp[n][2] = (dp[n-2][2])% 998244353;

    }

    signed main(){

    FastIO

    //cout<<fixed<<setprecision(10);

    int z;

    cin>>z;

    while(z–){

    int n;

    cin>>n;

    //is A have nth card he wins

    //similarly is B have nth card plus (n-2)th card B wins

    //else draw

    vvi dp (n+1 , vector<int> (3,-1));

    //as n is greater than 1

    //base cases

    dp[2][0] = 1;

    dp[2][1] = 0;

    dp[2][2] = 1;

    fun(n,dp);

    cout<<dp[n][0]<<" "<<dp[n][1]<<" "<<dp[n][2];

    cout<<endl;

    }

    return 0;

    }

  15. please can you share the entire code. I am not getting the correct answer for n=60. I couldn't understand how you defined Invfact[ ] and modInverse( ) ๐Ÿฅฒ

  16. Thanku and Hare krishna Sir ๐Ÿ™๐Ÿ™

  17. i did not understand the base case can you explain if possible

Leave a Reply

Your email address will not be published.