Educational Codeforces Round 140 Div 2 | Problem B : Block Towers Solution | Newton School

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ก.ย. 2024

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

  • @KaranMashru
    @KaranMashru ปีที่แล้ว +4

    (Subscribe for more such videos)
    Code :
    #include
    using namespace std;
    #define ll long long
    int main()
    {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll t, n, i, j;

    cin>>t;

    for(;t--;)
    {
    cin>>n;

    ll a[n];

    for(i=0; i>a[i];
    }

    sort(a+1, a+n);

    for(i=1; ia[0]){
    if((a[i]+a[0])%2==0){
    a[0]=(a[i]+a[0])/2;
    }else{
    a[0]=(a[i]+a[0])/2+1;
    }
    }
    }

    cout

  • @subhambhakat3908
    @subhambhakat3908 ปีที่แล้ว +4

    I guess todays problem D was lower than a B level proble.What the hell was problem C!!!!!!

  • @Nikhilsainiharidwar
    @Nikhilsainiharidwar ปีที่แล้ว +2

    Problem C

  • @QueenOfEvil-2
    @QueenOfEvil-2 ปีที่แล้ว +1

    why time complexity is o(nlogn)?

  • @Now_I_am_all_fired_up
    @Now_I_am_all_fired_up ปีที่แล้ว +1

    Sir Problem A

  • @anwar-cse
    @anwar-cse ปีที่แล้ว

    Good! But if you speak in English, it will be more understandable for us.

  • @SDE-wq4tl
    @SDE-wq4tl ปีที่แล้ว +2

    Upload D fast

  • @deepakjoshi4318
    @deepakjoshi4318 ปีที่แล้ว +1

    pura array kyu sort nhi kia?

    • @codingcommunitynewtonschoo8582
      @codingcommunitynewtonschoo8582  ปีที่แล้ว

      Bcoz when we are doing operation, one index should be 0 always, and from remaining 1 to n-1 indexes we pick the bricks and drop on index 0 as we are asked to make index 0 with max bricks possible. So we need 1 to n-1 sorted. I hope you got my point.

    • @deepakjoshi4318
      @deepakjoshi4318 ปีที่แล้ว

      @@codingcommunitynewtonschoo8582 yes got it thanks

  • @sagekikitchen6958
    @sagekikitchen6958 ปีที่แล้ว

    D daaldo bhai pls

  • @owaissiddiquei3733
    @owaissiddiquei3733 ปีที่แล้ว

    Problem C