Пікірлер
@abhiteshbhardwaj7240
@abhiteshbhardwaj7240 Күн бұрын
Nice Explanation
@nicspyy
@nicspyy 21 сағат бұрын
@@abhiteshbhardwaj7240 thanks ✨
@AkshitKumar-ed1pl
@AkshitKumar-ed1pl Күн бұрын
Inputf.in: file not recognized: File truncated Showing this while giving input
@nicspyy
@nicspyy 21 сағат бұрын
@@AkshitKumar-ed1pl i is smaller
@proto-ES
@proto-ES 6 күн бұрын
hy brother please give google drive link
@ritishrai581
@ritishrai581 6 күн бұрын
Lovely explanation for B
@nicspyy
@nicspyy 5 күн бұрын
@@ritishrai581 thanks ✨
@Krish-tyagi
@Krish-tyagi 6 күн бұрын
Build system not showing CP file
@nicspyy
@nicspyy 5 күн бұрын
@@Krish-tyagi please confirm save location once
@Krish-tyagi
@Krish-tyagi 5 күн бұрын
@@nicspyy yeah its done thanks for the tutorial
@samgoel4283
@samgoel4283 10 күн бұрын
Literally thanks bro greedy approach let's go
@nicspyy
@nicspyy 9 күн бұрын
@@samgoel4283 yeahhhhh
@Sadaf071
@Sadaf071 11 күн бұрын
there no cp in build system
@ikramb5394
@ikramb5394 10 күн бұрын
i have the same problem
@nicspyy
@nicspyy 9 күн бұрын
@@Sadaf071 have you skipped the video, I have added the file in starting of the video, CP.sublime-build that's the file which will come in build system latter on
@ikramb5394
@ikramb5394 9 күн бұрын
@@nicspyy i did everything just like the vedio the then I copied the code in new system but the problem that the output appears in CMD application in the same file
@Akhime42
@Akhime42 12 күн бұрын
latest update course hai ?
@nicspyy
@nicspyy 12 күн бұрын
content is 90,95% similar
@saimaripala-0638
@saimaripala-0638 13 күн бұрын
I cant able use the path to search I just installed minGW How to add it to path
@nicspyy
@nicspyy 12 күн бұрын
@@saimaripala-0638 search the mingw folder in directly, match the rest of the path from given in docs
@divine5863
@divine5863 13 күн бұрын
#define int long long int void solve(){ int n,c;cin>>n>>c; int sos=0,soi=0; for(int i=0;i<n;i++){ int a;cin>>a; sos+=(a*a); soi+=a; } long long d = sqrt((soi*soi-n*(sos-c))); int ans = -soi+d; cout<<ans/(2*n)<<endl; } why solving quadratic roots is not a good idea. Thanks
@divine5863
@divine5863 12 күн бұрын
i just changed int to float for soi and sos , it got accepted, can anyone tell me the reason
@amimultamim9893
@amimultamim9893 14 күн бұрын
Thanks a lot! Your explanation is very easy to understand.
@nicspyy
@nicspyy 14 күн бұрын
@@amimultamim9893 your welcome ✨
@S_o_ev
@S_o_ev 14 күн бұрын
just starting with cp these sort of video helps a lot
@nicspyy
@nicspyy 14 күн бұрын
@@S_o_ev yup, thanks bro ✨
@S_o_ev
@S_o_ev 14 күн бұрын
Great job man
@nicspyy
@nicspyy 14 күн бұрын
@@S_o_ev thanks ✨
@sanskargupta5299
@sanskargupta5299 17 күн бұрын
great explanation buddyyyy
@nicspyy
@nicspyy 16 күн бұрын
thanks bro❤❤
@mohitkumar-er8up
@mohitkumar-er8up 18 күн бұрын
the google doc is not working
@nicspyy
@nicspyy 18 күн бұрын
I will update the doc by tomorrow evening, thanks for reporting
@nicspyy
@nicspyy 16 күн бұрын
doc is now updated
@dewsara2888
@dewsara2888 19 күн бұрын
Thanks a lot for your help
@nicspyy
@nicspyy 19 күн бұрын
@@dewsara2888 welcome 😎
@yrulookinghere509
@yrulookinghere509 21 күн бұрын
cf id????
@kartiknagrale1479
@kartiknagrale1479 21 күн бұрын
@nicspyy
@nicspyy 21 күн бұрын
C solution: void solve(){ int n; cin>>n; string s; cin>>s; map<int,int> mp; for(auto &i: s) mp[i]++; priority_queue<pair<int,char>> pq; for(auto i: mp){ pq.push({ i.second, i.first }); } vector<string> a; int num = pq.top().first; char ch = pq.top().ss; pq.pop(); forn(i,0,num){ string s; s += ch; a.pb(s); } int ind = 0; while(!pq.empty()){ char ch = pq.top().ss; int num = pq.top().ff; while(num > 0){ a[ind] += ch; num--; ind = (ind + 1) % (a.size()); } pq.pop(); } string ans = ""; for(auto i: a) ans += i; cout<<ans<<' '; return; } ---------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------- D solution: void solve(){ int x; int m; cin >> x >> m; int secMex = 0; while(x--){ int n; cin>>n; set<int> s; forn(i,0,n) { int x; cin>>x; s.insert(x); } int num = 0; int cnt = 0; while(cnt < 2){ if(s.count(num) == 0){ s.insert(num); secMex = max(secMex, num); cnt++; } num++; } } if(m < secMex) { int ans = secMex*(m + 1); cout<<ans<<' '; }else{ int ans = secMex*(secMex + 1); int greater = ((m*(m+1))/2) - ((secMex*(secMex+1))/2); cout<<ans+greater<<' '; } }
@12bpurshottam6
@12bpurshottam6 25 күн бұрын
nice explanation 🤩
@nicspyy
@nicspyy 24 күн бұрын
@@12bpurshottam6 thanks ✨
@Entertainmentexe
@Entertainmentexe Ай бұрын
Expected difficulty level of D and E?
@nicspyy
@nicspyy Ай бұрын
@@Entertainmentexe D 1200, E 1400-1500
@RajinderSingh-tm8ln
@RajinderSingh-tm8ln Ай бұрын
bro do you have Angela Yu course 100 days of code or any good mean stack or any of his course ?? pls let me know she is an amazing mentor
@nicspyy
@nicspyy Ай бұрын
@@RajinderSingh-tm8ln I will check and will notify
@PratikDongare-bh2vs
@PratikDongare-bh2vs Ай бұрын
good explaination
@nicspyy
@nicspyy Ай бұрын
thanks bro💕💕
@mr.kamina3364
@mr.kamina3364 Ай бұрын
nice explanation bro keep it up
@nicspyy
@nicspyy Ай бұрын
@@mr.kamina3364 thanks bro ✨
@ashish3487
@ashish3487 Ай бұрын
nice explanation bhaiya
@nicspyy
@nicspyy Ай бұрын
@@ashish3487 thanks bro ✨
@GAGGZz
@GAGGZz Ай бұрын
Hey bro , could you make a video on how to get started with competitive programming? It would be great if you could also share how you manage to solve all four questions in LeetCode contests, along with tips for improving problem-solving skills and practicing effectively. If making a video isn't possible, a detailed reply would be much appreciated!
@nicspyy
@nicspyy Ай бұрын
@@GAGGZz Hii, actually I was planning to make such video from long time ago, will be releasing too, but I guess not now, Instead we can talk on LinkedIn I will surely help you in the way I can
@GAGGZz
@GAGGZz Ай бұрын
Ok bro I will message you on LinkedIn
@nicspyy
@nicspyy Ай бұрын
@@GAGGZz sure
@AnshGupta-cq2rr
@AnshGupta-cq2rr Ай бұрын
I have doubt in e can't I right bottom as min(n,i+k-1)
@nicspyy
@nicspyy Ай бұрын
@@AnshGupta-cq2rr think once more like we are calculating the bottom value, not necessarily every time bottom will be in "bottom of the current cell" but can be above also
@nicspyy
@nicspyy Ай бұрын
@@AnshGupta-cq2rr hope you get it 🤔
@AnshGupta-cq2rr
@AnshGupta-cq2rr Ай бұрын
@@nicspyy sorry but I couldn't get it
@nicspyy
@nicspyy Ай бұрын
@@AnshGupta-cq2rr dm on LinkedIn we will discuss
@blackvelta1913
@blackvelta1913 Ай бұрын
good job
@nicspyy
@nicspyy Ай бұрын
@@blackvelta1913 thanks ✨
@nicspyy
@nicspyy Ай бұрын
D solution: void solve(){ int n; cin>>n; vi a(n); forn(i,0,n) cin>>a[i]; string s; cin>>s; vector<int> pre(n, 0); pre[0] = a[0]; for(int i=1; i<n; i++){ pre[i] = pre[i-1] + a[i]; } int sum = 0; int i = 0; int j = n-1; while(i < j){ if(s[i] == 'R') i++; else if(s[j] == 'L') j--; else{ sum += pre[j]; if(i-1 >= 0) sum -= pre[i-1]; i++; j--; } } cout<<sum<<' '; } ------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------ E solution: void solve(){ int n, m, k; cin >> n >> m >> k; int w; cin >> w; vector<int> heights(w); for (int i = 0; i < w; ++i) { cin >> heights[i]; } sort(rall(heights)); vector<int> contributions(n * m, 0); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { int top = max(0ll, i - k + 1); int bottom = min(n - k, i); int left = max(0ll, j - k + 1); int right = min(m - k, j); // cout<<top<<' '<<bottom<<' '<<left<<' '<<right<<' ' int count = (bottom - top + 1) * (right - left + 1); contributions[i * m + j] = count; } } sort(contributions.begin(), contributions.end(), greater<int>()); int max_spectacle = 0; int len = min(w, (int)contributions.size()); for (int i = 0; i < len; ++i) { max_spectacle += heights[i] * contributions[i]; } cout << max_spectacle << endl; }
@nicspyy
@nicspyy Ай бұрын
B solution: void solve(){ int n; cin>>n; vi a(n); forn(i,0,n) cin>>a[i]; for(int i=0; i<n-1; i++){ swap(a[i], a[i+1]); } for(auto i: a){ cout<<i<<' '; } cout<<' '; } ------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------ C solution: int vMed(vector<int> t, int n){ return t[(n - 1) / 2]; } int Med(int a[], int n){ return a[(n - 1) / 2]; } bool check(int x, int a[], int b[], int n, int k){ int targ = (n - 1) / 2 + 1; int s = 0, cnt = 0; for(int i=n-2; i>=0; i--){ if(a[i] >= x){ cnt++; if(cnt >= targ){ break; } } else{ if(b[i]){ s += x - a[i]; cnt++; if(s > k){ return false; } if(cnt >= targ){ break; } } } } return (s <= k and cnt >= targ); } void solve(){ int n, k; cin >> n >> k; int a[n], b[n]; bool haveOne = false; pair<int, int> t[n]; for(int i = 0; i < n; i++){ cin >> t[i].ff; } for(int i = 0; i < n; i++){ cin >> t[i].ss; } sort(t, t + n); for(int i = 0; i < n; i++){ a[i] = t[i].ff; b[i] = t[i].ss; haveOne |= b[i]; } int ans1 = 0; if(haveOne){ for(int i = n - 1; i>=0; i--){ if(b[i]){ vector<int> t; t.pb(a[i] + k); for(int j = 0; j < n; j++){ if(i == j){ continue; } t.pb(a[j]); } sort(all(t)); ans1 = vMed(t, n - 1) + t[n - 1]; break; } } } else{ cout << a[n - 1] + Med(a, n - 1) << endl; return; } int l = 0; int r = 1e10; while(l+1 < r){ int m = (l+r)/2; if(check(m, a, b, n ,k)) l = m; else r = m; } for(int i = 0; i < n - 1; i++){ if(b[i] and a[i] < l){ a[i] = l; } } sort(a, a+n); int ans2 = a[n - 1] + Med(a, n - 1); cout << max(ans1, ans2) << endl; }
@sehajmakkarr
@sehajmakkarr Ай бұрын
the google doc in the description is not working
@nicspyy
@nicspyy Ай бұрын
what problem are you facing exactly
@sehajmakkarr
@sehajmakkarr Ай бұрын
@@nicspyy it is working now, and thankyou for the setup!
@saranathrajaram639
@saranathrajaram639 Ай бұрын
Mingw setup problem what to do
@nicspyy
@nicspyy Ай бұрын
can you explain in brief
@ronakkriplani1838
@ronakkriplani1838 Ай бұрын
what is wrong in this int main() { int t; cin >> t; while (t--) { int n; cin>>n; string s; cin>>s; int c=0; for(int i=0;i<n;i++){ if(s[i]=='('){ c++; }else if(s[i]==')'){ c--; }else{ if(c>=1){ s[i]=')'; c--; }else{ c=1; s[i]='('; } } } stack<char>st; ll ans=0; for(int i=0;i<n;i++){ if(s[i]=='('){ st.push(i); }else{ if(!st.empty()){ ans+=i-st.top(); st.pop(); } } } cout<<ans<<endl; } }
@virendrakeshri6072
@virendrakeshri6072 Ай бұрын
nice share
@nicspyy
@nicspyy Ай бұрын
Thanks bro
@RajinderSingh-tm8ln
@RajinderSingh-tm8ln Ай бұрын
bro it's asking for decryption key can u pls provide it the course is really helpful
@nicspyy
@nicspyy Ай бұрын
@@RajinderSingh-tm8ln i tried opening, it was not asking can you verify once
@RajinderSingh-tm8ln
@RajinderSingh-tm8ln Ай бұрын
@@nicspyy I shared this mega link to my brother and he opened it in chrome in his mobile but there it is asking for the decryption key I also tried to open the link in incognito mode but it did not help either ??
@nicspyy
@nicspyy Ай бұрын
@@RajinderSingh-tm8ln is it issue with download, coz i tried both download and online stream it is working absolutely fine
@RajinderSingh-tm8ln
@RajinderSingh-tm8ln Ай бұрын
@@nicspyy should I share you the image asking for decryption key ??
@RajinderSingh-tm8ln
@RajinderSingh-tm8ln Ай бұрын
@@nicspyy bro pls help me out here ??
@nicspyy
@nicspyy Ай бұрын
B solution: void solve(){ int n; cin>>n; vs a(2); cin>>a[0]; cin>>a[1]; int cnt = 0; for(int i=2; i<n; i++){ if(a[0][i-2] == '.' and a[1][i-2] == 'x' and a[0][i-1] == '.' and a[1][i-1] == '.' and a[0][i] == '.' and a[1][i] == 'x'){ cnt++; }else if(a[0][i-2] == 'x' and a[1][i-2] == '.' and a[0][i-1] == '.' and a[1][i-1] == '.' and a[0][i] == 'x' and a[1][i] == '.'){ cnt++; } } cout<<cnt<<' '; } C solution: void solve(){ int n; cin >> n; string s; cin >> s; int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == '(') { cnt++; } else if (s[i] == ')') { cnt--; } else { if (cnt >= 1) { s[i] = ')'; cnt--; } else { cnt = 1; s[i] = '('; } } } vector<int> st; int ans = 0; for (int i = 0; i < n; i++) { if (s[i] == '(') { st.push_back(i); } else { ans += i - st.back(); st.pop_back(); } } cout << ans << endl; } D solution: void dfs(int k,int fa, vector<vi> &v, vi &minn, vi &a) { bool check=1; for(auto now : v[k]) { if(now==fa) continue; check=0; dfs(now, k, v, minn, a); minn[k]=min(minn[k],minn[now]); } if(check) minn[k]=a[k]; if(k==1||minn[k]<=a[k]) return; minn[k]=(minn[k]+a[k])/2; return; } void solve() { int n; cin>>n; vi minn(n+1, 1e9); vi a(n+1); vector<vi> v(n+1); for(int i=1;i<=n;i++) cin>>a[i]; for(int i=2;i<=n;i++){ int x; cin>>x; v[i].pb(x); v[x].pb(i); } dfs(1,-1, v, minn, a); cout<<a[1]+minn[1]<<" "; return; }
@ujjwalagrawalvideos
@ujjwalagrawalvideos Ай бұрын
nicely explained
@nicspyy
@nicspyy Ай бұрын
@@ujjwalagrawalvideos thanks
@saurabhkr78
@saurabhkr78 Ай бұрын
error after ctrl+b The system cannot find the file specified. [Finished in 334ms]
@nicspyy
@nicspyy Ай бұрын
is ur folder structure same as mine
@RimoGhosh-p5b
@RimoGhosh-p5b Ай бұрын
why n - cnt ??
@ntsequalifier341
@ntsequalifier341 Ай бұрын
Bro hindi me bol le agar english nahi boli jaati no offense but solution is good, but communication too matters. Yahan hindi ki public bhi aati hai, tere videos chalenge
@manishkumar-uw5mw
@manishkumar-uw5mw Ай бұрын
nice explanation
@nicspyy
@nicspyy Ай бұрын
@@manishkumar-uw5mw thanks 🌟
@nicspyy
@nicspyy Ай бұрын
b solution: void solve(){ int n, m; cin >> n >> m; vi arr(n); forn(i,0,n) cin>>arr[i]; vi arr2(n); forn(i,0,n) cin>>arr2[i]; map<int, int> mp; for (int i = 0; i < n; i++) { mp[arr[i]] += arr2[i]; } int ans = 0; for (auto &i : mp){ int p1 = i.first; int cs1 = i.second; int count1 = m / p1; int x = 0; int mon = m; int m1 = 0; x += p1 * min(count1, cs1); m1 = min(count1, cs1); mon -= p1 * min(count1, cs1); int y =x; int mon_ = mon; if (mp.find(p1 + 1) != mp.end()) { int am2 = mp[p1 + 1]; int am3 = mon_ / (p1 + 1); x += (p1 + 1) * min(am2, am3); mon_ -= (p1 + 1) * min(am2, am3); if(mon_ > 0){ if(am3 < am2){ int left = am2-am3; int aa = min(mon_, left); x += min(m1,aa); } } } ans = max(x, ans); } cout << ans << endl; }
@RimoGhosh-p5b
@RimoGhosh-p5b Ай бұрын
#include <bits/stdc++.h> using namespace std; using ll = long long int; using vi = vector<ll>; using vc = vector<char>; using vvi = vector<vector<ll>>; using vvc = vector<vector<char>>; using vb = vector<bool>; using vvb = vector<vector<bool>>; using vs = vector<string>; using pll = pair<ll, ll>; using mii = map<ll, ll>; using vii = vector<pair<ll, ll>>; #define int long long int #define gcd(a, b) __gcd(a, b) #define lcm(a, b) (1ll * (a / gcd(a, b)) * b) #define all(a) a.begin(), a.end() #define rall(a) a.end(), a.begin() #define f(i, a, b) for (int i = a; i < b; i++) #define rf(i, a, b) for (int i = a; i >= b; i--) #define ceildiv(a, b) ((a + b - 1) / b) #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define re return const int MOD = 1e9 + 7; const int MAX = 2e5; int dp = 1e9; #define inp(arr) \ for (auto &it : arr) \ cin >> it; void solve() { int n; cin >> n; vi arr(n - 1); inp(arr); vi ans; int k = n * (n + 1) / 2; f(i, 0, n - 1) { if (arr[i] > k) { cout << "No" << endl; re; } } if (arr.back() != k) { arr.pb(k); arr.insert(arr.begin(), 0); f(i, 1, n + 1) { ans.pb(arr[i] - arr[i - 1]); } set<int> st; vi res; f(i, 1, n + 1) st.insert(i); for (auto &el : ans) { if (st.find(el) != st.end()) { st.erase(el); } else { res.pb(el); } } if (st.empty()) { cout << "YES" << endl; } else cout << "NO" << endl; re; } else { arr.insert(arr.begin(), 0); f(i, 1, n) { ans.pb(arr[i] - arr[i - 1]); } set<int> st; vi res; f(i, 1, n + 1) st.insert(i); for (auto &el : ans) { if (st.find(el) != st.end()) { st.erase(el); } else { res.pb(el); } } if (res[0] == accumulate(all(st), 0)) { cout << "YES" << endl; re; } else cout << "NO" << endl; re; } } signed main() { int t; cin >> t; while (t--) { solve(); } return 0; }
@AvantKnowledge
@AvantKnowledge Ай бұрын
code of 3 please provide
@nicspyy
@nicspyy Ай бұрын
@@AvantKnowledge actually yesterday i didn't gave the contest just build the basic intuition and tried to submit with alt account, so didn't submit 3rd myself but intuition is correct, you can get the code from the editorial the approach is same. thanks ✌️
@Josuke217
@Josuke217 Ай бұрын
@@nicspyy you are not allowed to use alt accounts on codeforces, now I understood why you haven't shared your CF ID
@nicspyy
@nicspyy Ай бұрын
@@Josuke217 who make this rule
@Josuke217
@Josuke217 Ай бұрын
@@nicspyy Mike Mirzayanov - creator of CF
@nicspyy
@nicspyy Ай бұрын
@@Josuke217 ohh !! but everyone makes
@nainaryan
@nainaryan Ай бұрын
in third que , in your example test 17:42 case how 9 can be part of MAD subarray(int 3rd line) if it is occuring only once in previous array frequency >= 2 nah ?
@nicspyy
@nicspyy Ай бұрын
ohh !! yes i notice, i compare it with the 1st array, thanks ❤
@jayantdubey8398
@jayantdubey8398 Ай бұрын
In the third question if values were values are 3333221 the it won't be areenged in non decreasing order
@nicspyy
@nicspyy Ай бұрын
@@jayantdubey8398 yes, that what i said, after 1 or 2 operation the arrya will be in accessing order
@tej.askamble
@tej.askamble Ай бұрын
In Second Question (B.Array Craft)... Instead of taking -1 and 1 alternative if we write -1 always. Will it give write ans??
@nicspyy
@nicspyy Ай бұрын
@@tej.askamble no take that wrt to other number, like alternative 1,-1 after x, willl be in sufix of y, and if number of -1 are greater than 1s then its wa
@parasjeeprep3206
@parasjeeprep3206 Ай бұрын
lets take n=10, x=8 , y=7 therefor acc. to your logic we will keep -1 from 1 to 6(just before 7) now prefix sum at 8 will be -4 but at 1 position it was -1 which was better
@tej.askamble
@tej.askamble Ай бұрын
@@nicspyy got it.. thanks
@tej.askamble
@tej.askamble Ай бұрын
@@parasjeeprep3206 thanks
@akashsuryavanshi7026
@akashsuryavanshi7026 Ай бұрын
Bro, great Explanation!!
@nicspyy
@nicspyy Ай бұрын
thanks
@kashmirtellerking827
@kashmirtellerking827 Ай бұрын
bhai pattern wale question nhi ho paate div 2 ka c jabki div 3 ka e ho jate h
@nicspyy
@nicspyy Ай бұрын
in div 3 contest, concept wise they are easy, but in div 2 concept maybe not known so it's my observation, and i suggest to practice constructive problems more for pattern
@bhagadbillop3514
@bhagadbillop3514 Ай бұрын
if you print matrix into reverse order then the center element will not change its position wrong approach
@nicspyy
@nicspyy Ай бұрын
❤❤