Codeforces Round 952 (Div 4) | Video Solutions - A to H1 | by Viraj Chandra | TLE Eliminators
Vložit
- čas přidán 10. 06. 2024
- Here are the video solutions in the form of a post-contest discussion for problems A, B, C, D, E, F, G, H1 of Codeforces Global Round 26. 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 - codeforces.com/contest/1985/s...
Problem B - codeforces.com/contest/1985/s...
Problem C - codeforces.com/contest/1985/s...
Problem D - codeforces.com/contest/1985/s...
Problem E - codeforces.com/contest/1985/s...
Problem F - codeforces.com/contest/1985/s...
Problem G - codeforces.com/contest/1985/s...
Problem H1 - codeforces.com/contest/1985/s...
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:55 Problem A
4:00 Problem B
12:44 Problem C
26:22 Problem D
38:20 Problem E
1:03:00 Problem F
1:24:42 Problem G
1:53:53 Problem H1
Please fill the feedback form for PCD: forms.gle/qoc6BDkEeCntCncu8
ah, finally Viraj sir, he good PCD very very good, please assign viraj sir always or most of the time.
Best explanation for the problems till now
Sir, Please upload Leetcode Weekly Contest 401 Solutions. We're addicted to your explanation🥺🙏
Kya hi pyaara aur bdhia teacher hai.. thank you sir.... baaki sab teachers ko smjhana nahi aata priyansh bhaia.. please let this teacher do all your videos.... he is amazing
TLE ELIMINATORS IS IMPROVING DAY-BY-DAY CONTESTS -AFTER-CONTESTS KUDOOS TO THE TEAM
KEEP IT UP
Intuition + world class explanation !
Please TLE make all the editorials by Viraj and Gaurish,They are LGM at explanation ! other than these two all are newbies . Guys if you agree like the comment so that they can hear asap
loved the explanation of the E question was absolutely on point
Great explanation Sir! 😇
Those who are trying for problem F the working range of r is 1e13 not 1e18.So don't take more than that.
Because in worst case :
power[i] = 2*1e5
cooldown[i]=1
and mid=(0+1e13)/2 => 1e13/2;
Therefore, attack Power at that moment (2*1e5*1e13)/2 ==> 1e18.
Therefore range of 'r' more than that won't work.
yes i got hacked after contest🥲
Hi! Yes, you are correct. I have cleared this out in the other comments and also attached the correct submission link.
😇
The way you explained g with the exact intuition you had during contest is just awesome. Keep this quality
man this is like so good . these kind of explanation with intution is what makes a difference !
Thanks for such a detailed explanation.
Great explanation, I've seen a lot of people do this but they all skip some or the other steps but this was just fantastic.
I hope you continue the good work 😊
Thank you for this
Great explanation
Awesome explanation viraj🎉
great explanation. keep it up!
Thanks!
I did like the way he explained ,super
In 3Q. (Good Prefix) If we take an array 1 2 2 3 then 5≠3 but 2+2=3+1 so it's a good array but it won't be counted according to the given solution....
Please help me out
Only one element has to be equal to all sum.
In F . Try setting the high pointer =h *(2e5). This will work. Because worst case scenario is attack is 1 and its turn is 2e5
A pointer for 10^12 works. Base point, try not to overflow. Had this been python we would have been good enough.
@@VirajChandra Yes exactly.
Thanks bro
@@VirajChandra can you explain why we should take higher limit r = 1e18 ?
can't undestand that.
good explaination
F is testcse pe nhi chlega.Jab n ki value 2*10^5 ho,saare ai ki value 2*10^5 ho aur saare ci ki value 1 ho. Fir hum log jo sum le rhe hai loop me wo overflow kar jayega. Isliye apne ko loop me hi check karlena chahiye aur jaise hi sum health se bada hota to whi pe break kar dena chahiye.
Hi, not exactly this, since I already have a check for h health becoming zero. So if everything is 2*10^5 then h becomes zero before going to BS.
Correct hack to my solution would be if we give some case where I don’t exhaust h before going to BS. Anyways, hacking is fun!
I’ll change the submission link so that we get a better solution.
@@VirajChandra okay got it
i too got same intutuion when i look into problem d
sir, i'm having an issue, i can't solve div2 problems but i'm not complete newbie, shld i join level2 tle course
want discussions for every contest
in problem F , why did you take higher limit = 1e18?
Viraj bhaiya god op
aaap best ho jiii.......
Hi Viraj sir. Your vs code sectioning looks awesome. Please teach us how to set it up. Thanks!!
Sure, I'll try to cover a video on it.
r=10^18 dosen't work. use 10^12 instead of 10^18. it works prefect
Hi! Yes, you are correct. I have cleared this out in the other comments and also attached the correct submission link.
F is an easy binary search on the answer . Missed it...
Mine got hacked anyways
I did try like that but it didn't work for me though
Could anyone tell that test case where binary search getting wrong
@@geethakarnatikyu mc?
@@geethakarnatihack karega?
In question E, k % ( a * b) and k /(a * b)
Hi! Since side c has to be integer, a*b should fully divide k. Hence k%(a*b). Next, whichever side value you get has to be less than equal to z, since your side c cannot go above z. Hence second condition.
@@VirajChandra Okey sir got it thank you
F will also work on priority queue it passed for me
+1
That’s great! I mentioned in the video that I did not give alot of thought to the time complexity of a quick implementation in priority queue, so I went ahead with bs. It’s nice that you were able to solve it using priority queue.
Plz share Submission and Approach
@@VirajChandra Sir can you please share the approach with priority queues
@@gigachad2419 here is the approach just maintain a minheap where you keep the next time when you can use ith attack :
#include
using namespace std;
#define ll long long int
#define uni unsigned long long int
#define pb(x) push_back(x)
#define sz(arr) arr.size()
#define ssz(s) s.length()
#define nl endl
#define read(arr,n) for(ll i=0;i>arr[i]
#define srt(arr) sort(arr.begin(),arr.end())
#define srtr(arr) sort(arr.rbegin(),arr.rend())
#define rev(arr) reverse(arr.begin(),arr.end())
#define pi pair
#define pl pair
#define vi vector
#define vll vector
#define vuni vector
#define vpi vector
#define vpl vector
#define vii vector
#define vlll vector
#define mn(a) *min_element(a.begin(),a.end())
#define mx(a) *max_element(a.begin(),a.end())
#define vs vector
#define vss vector
#define vc vector
#define vcc vector
#define pre_sum(pre,arr,n) for(i=1;i=0;i--) suf[i]=suf[i+1]+arr[i]
const double pie=3.14159265358979323846264338327950;
const ll mod=1e9+7;
ll gcd(ll a,ll b){
while(a!=0 && b!=0){
if(a>b) a%=b;
else b%=a;
}
if(a==0) return b;
return a;
}
class cmp{
public:
bool operator()(pl p1,pl p2){
return p1.first>p2.first;
}
};
int main()
{
int t;
cin>>t;
while(t--){
ll h,n,time=1,p=0;
cin>>h>>n;
vll a(n),c(n);
read(a,n);
read(c,n);
priority_queue pq; //p.first=time,p.second=index
for(ll i=0;i
how are you able to submit a solution at 5: 38 pm ??
Which one?
5:38 pm is according to Moscow time
Sir, why your solution of F got hacked
Initially, when I put a check for h being negative, I thought that would suffice the overflow check. But I think we can bypass it, so keeping high as a lower value works now. Solution has been updated.
@@VirajChandra got it
can anyone help me with this, i am using priority queue and getting wrong answer at test case 16
#include
using namespace std;
int main(){
long long t;
cin>>t;
vector ans;
while(t--){
int h,n;
cin>>h>>n;
vector damage(n),cooldown(n);
for(long long i=0;i>damage[i];
for(long long i=0;i>cooldown[i];
priority_queue pq;
for(long long i=0;i
What is the TC 16?
@@VirajChandra Done, all test cases passed.
@@001_abhijeetkumar7 faced the same problem what the issue?
How can I change my c++14 compiler to c++17 I have the required gcc version....Anyone please help
download from mingw
Use compiler flag `-std=c++17` while compiling your c++ file without backticks
Are you using some extension?
use c++20 and precompile. If u want I can give complete setup (my github repo)
@@devvikramsingh7785 yes please