Bricks and Bags || Codeforces Round 831 Div1+2 Problem C

  Рет қаралды 4,500

Competitive Coding - Newton School

Competitive Coding - Newton School

Күн бұрын

Пікірлер: 43
@vishalagarwal9392
@vishalagarwal9392 Жыл бұрын
absurd explanation of the year!!
@revanthkalavala1829
@revanthkalavala1829 2 жыл бұрын
Nice question. I completely went on different path. Nice explanation I Kept min element in bag 3 and maximum element in another bag 2 , and rest all other elements in bag 1 Should have created more examples and tried out but trying out examples in paper, to find optimal answer itself is tiring for this question
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Questions like these are quite luck oriented. Either you solve it in 10 minutes or take the whole contest for it.
@aaravgautam7263
@aaravgautam7263 2 жыл бұрын
yep today second option fitted for me😁
@saumyaranjan9256
@saumyaranjan9256 2 жыл бұрын
yup, went with the same exact approach for this question and got it wrong.
@KaifKhan-gs7lw
@KaifKhan-gs7lw 2 жыл бұрын
I tried the same thing🙃
@devanshgoel3433
@devanshgoel3433 2 жыл бұрын
I also tried the same approach as told by @revanth.
@praveenkpandey34
@praveenkpandey34 6 ай бұрын
amazing ! editorial , i mean it is way way better then actual editorial ..
@nikhildixit5687
@nikhildixit5687 Жыл бұрын
such a nice explanation lot of hard work by you, kudos!!!!!!!!
@leoara8019
@leoara8019 2 жыл бұрын
thank you soo much greetings from Syria
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
No worries 🤠
@rohitsatpute9578
@rohitsatpute9578 2 жыл бұрын
What a explanation!! Hats off
@kamranali4358
@kamranali4358 2 жыл бұрын
Can you please explain observation 1?
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
It just means that in the optimal answer, array will be broken into contiguous segments.
@priovag2632
@priovag2632 2 жыл бұрын
Can I ask you why do we use the max for abs(arr[i]-arr[i+1) and abs(arr[i]-arr[i-1]), instead of min? The taker always try to get the closest so the taker can reduce the total score, right? Thank you.
@sudhanshu9831
@sudhanshu9831 2 жыл бұрын
We are assigning the weights in bags. So we'll assign them in a way we get the maximum answer. After that, the taker may choose any way and he'll get the minimum answer as given
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
This depends on how we assign bags, not on how the taker chooses bricks. So we take max, as it's upto us to assign maximum score.
@ayyappaswamy8220
@ayyappaswamy8220 2 жыл бұрын
In the first example if we pick bricks whose weights are 1 5 2 the answer would be 7 which is greater than 6. Why shouldn't we pick 1 5 2
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Because the person picking the bricks, wants to minimise the score. He will pick the bricks from the given bags such that score is minimum. We want to create these bags such that this minimum score is as big as possible.
@criticcell
@criticcell 2 жыл бұрын
Hey, I was just wondering about this. I see a lot of channels with the name of Newton School in it. Do they select creators or is this an opportunity open to all. Please specify the details on how someone can be a part of it.
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
They select creators. I don't know to apply for it though. A senior referred me for it.
@rohitn6333
@rohitn6333 2 жыл бұрын
Thanks for this wonderful solution sir could you upload D also
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Already uploaded
@rohitn6333
@rohitn6333 2 жыл бұрын
@@competitivecoding-newtonsc9601 thank you sir, please continue uploading these solutions. These are very helpful sir Your way of explaining is very good sir
@xolo2617
@xolo2617 2 жыл бұрын
is it type of book allocation problem , where we use binary search ?
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Ahh not sure, how you can use binary search on this.
@kamranali4358
@kamranali4358 2 жыл бұрын
What could be rating of this problem?
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
1500
@kumaramit04-q6c
@kumaramit04-q6c 2 жыл бұрын
I also used the same approach.
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Nice ;)
@CosmoVision1
@CosmoVision1 2 жыл бұрын
Good explanation. However, I put the max element in bag 2, min element in bag 3 and all elements that are left in bag 1 but this solution fails on test 2 and I can't figure out why, could you give an example where this solution fails?
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Try 1,2,7,10,10
@sfg805
@sfg805 11 ай бұрын
please tell me whats wrong in my approach ll n; cin >> n; vl arr(n); setst; loop(i,n){ cin>>arr[i]; st.insert(arr[i]); } ll ans=0; sort(all(arr)); ans+=abs(arr[0]-arr[n-1]); ll maxi=1e9; ll maxi2=1e9; for(int i=1;i
@satvikdixit
@satvikdixit 2 жыл бұрын
Upload D and E as well plz
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
Will work on it.
@gurmansingh1878
@gurmansingh1878 2 жыл бұрын
Bro can you kindly tell why this code fails...the logic we applied to bag3 (i.e it's size == 1) we can also minimize the size of bag2 == 1 ( we tend to reduce a3) and remaining elements in bag1 void solve() { int n; cin >> n; vll wt(n); for(auto &i : wt) cin >> i; sort(all(wt)); ll ans = (wt.back() - wt.front()); ll m1 = N, m2 = N; for(int i = 1; i < n-1; ++i) { m1 = min(wt[i] - wt.front(), m1); m2 = min(wt.back() - wt[i], m2); debug(m1, m2); } ans += max(m1, m2); cout
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
How are you placing the bags?
@gurmansingh1878
@gurmansingh1878 2 жыл бұрын
@@competitivecoding-newtonsc9601 by taking ..if bag2 as min then bag3 as max vice-versa ..and just keeping all reamining values i.e from index i = 1 ...n-1 in bag1
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
What about case like 1 1 2 3 3 ? Isn't it optimal to assign 1 1 or 3 3 to bag 2?
@gurmansingh1878
@gurmansingh1878 2 жыл бұрын
@@competitivecoding-newtonsc9601 Thanks a lot bro...I understand clearly
@nikhilkumarv2577
@nikhilkumarv2577 2 жыл бұрын
🛐
@competitivecoding-newtonsc9601
@competitivecoding-newtonsc9601 2 жыл бұрын
:)
Complementary XOR || Codeforces CodeTon Round 3 Problem C
17:10
Competitive Coding - Newton School
Рет қаралды 2,9 М.
Almost All Multiples || Codeforces Round 836 Div2 Problem C
15:52
Competitive Coding - Newton School
Рет қаралды 1,9 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 18 МЛН
One day.. 🙌
00:33
Celine Dept
Рет қаралды 63 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 256 МЛН
Awoo's Favorite Problem || Codeforces Educational Round 130 Div2 Problem C
14:24
Competitive Coding - Newton School
Рет қаралды 7 М.
Zero-Sum Prefixes || Codeforces Round 833 Div2 Problem C
20:08
Competitive Coding - Newton School
Рет қаралды 1,8 М.
Recover an RBS || Codeforces Educational Round 132 Div2 Problem C
16:52
Competitive Coding - Newton School
Рет қаралды 4,3 М.
Digital Logarithm || Codeforces Educational Round 135 Div2 Problem C
17:29
Competitive Coding - Newton School
Рет қаралды 3,3 М.
Min-Max Array Transformation || Codeforces Educational Round 134 Div2 Problem C
19:57
Competitive Coding - Newton School
Рет қаралды 4,3 М.
Codeforces Round 837 Div 2 | Problem B : Hossam And Friends Solution | Newton School
16:05
Coding Community | Newton School
Рет қаралды 6 М.
Schedule Management || Codeforces Educational Round 131 Div2 Problem C
23:47
Competitive Coding - Newton School
Рет қаралды 5 М.
Mark and Lightbulbs || Codeforces Round 807 Div2 Problem D
16:06
Competitive Coding - Newton School
Рет қаралды 5 М.
Codeforces Round 831 Div1+2|C. Bricks and Bags||code+Explanation
16:45
Code With Singh
Рет қаралды 1,1 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 18 МЛН