Inputf.in: file not recognized: File truncated Showing this while giving input
@nicspyy21 сағат бұрын
@@AkshitKumar-ed1pl i is smaller
@proto-ES6 күн бұрын
hy brother please give google drive link
@ritishrai5816 күн бұрын
Lovely explanation for B
@nicspyy5 күн бұрын
@@ritishrai581 thanks ✨
@Krish-tyagi6 күн бұрын
Build system not showing CP file
@nicspyy5 күн бұрын
@@Krish-tyagi please confirm save location once
@Krish-tyagi5 күн бұрын
@@nicspyy yeah its done thanks for the tutorial
@samgoel428310 күн бұрын
Literally thanks bro greedy approach let's go
@nicspyy9 күн бұрын
@@samgoel4283 yeahhhhh
@Sadaf07111 күн бұрын
there no cp in build system
@ikramb539410 күн бұрын
i have the same problem
@nicspyy9 күн бұрын
@@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
@ikramb53949 күн бұрын
@@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
@Akhime4212 күн бұрын
latest update course hai ?
@nicspyy12 күн бұрын
content is 90,95% similar
@saimaripala-063813 күн бұрын
I cant able use the path to search I just installed minGW How to add it to path
@nicspyy12 күн бұрын
@@saimaripala-0638 search the mingw folder in directly, match the rest of the path from given in docs
@divine586313 күн бұрын
#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
@divine586312 күн бұрын
i just changed int to float for soi and sos , it got accepted, can anyone tell me the reason
@amimultamim989314 күн бұрын
Thanks a lot! Your explanation is very easy to understand.
@nicspyy14 күн бұрын
@@amimultamim9893 your welcome ✨
@S_o_ev14 күн бұрын
just starting with cp these sort of video helps a lot
@nicspyy14 күн бұрын
@@S_o_ev yup, thanks bro ✨
@S_o_ev14 күн бұрын
Great job man
@nicspyy14 күн бұрын
@@S_o_ev thanks ✨
@sanskargupta529917 күн бұрын
great explanation buddyyyy
@nicspyy16 күн бұрын
thanks bro❤❤
@mohitkumar-er8up18 күн бұрын
the google doc is not working
@nicspyy18 күн бұрын
I will update the doc by tomorrow evening, thanks for reporting
@nicspyy16 күн бұрын
doc is now updated
@dewsara288819 күн бұрын
Thanks a lot for your help
@nicspyy19 күн бұрын
@@dewsara2888 welcome 😎
@yrulookinghere50921 күн бұрын
cf id????
@kartiknagrale147921 күн бұрын
❤
@nicspyy21 күн бұрын
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<<' '; } }
@12bpurshottam625 күн бұрын
nice explanation 🤩
@nicspyy24 күн бұрын
@@12bpurshottam6 thanks ✨
@EntertainmentexeАй бұрын
Expected difficulty level of D and E?
@nicspyyАй бұрын
@@Entertainmentexe D 1200, E 1400-1500
@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Ай бұрын
@@RajinderSingh-tm8ln I will check and will notify
@PratikDongare-bh2vsАй бұрын
good explaination
@nicspyyАй бұрын
thanks bro💕💕
@mr.kamina3364Ай бұрын
nice explanation bro keep it up
@nicspyyАй бұрын
@@mr.kamina3364 thanks bro ✨
@ashish3487Ай бұрын
nice explanation bhaiya
@nicspyyАй бұрын
@@ashish3487 thanks bro ✨
@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Ай бұрын
@@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Ай бұрын
Ok bro I will message you on LinkedIn
@nicspyyАй бұрын
@@GAGGZz sure
@AnshGupta-cq2rrАй бұрын
I have doubt in e can't I right bottom as min(n,i+k-1)
@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Ай бұрын
@@AnshGupta-cq2rr hope you get it 🤔
@AnshGupta-cq2rrАй бұрын
@@nicspyy sorry but I couldn't get it
@nicspyyАй бұрын
@@AnshGupta-cq2rr dm on LinkedIn we will discuss
@blackvelta1913Ай бұрын
good job
@nicspyyАй бұрын
@@blackvelta1913 thanks ✨
@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Ай бұрын
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Ай бұрын
the google doc in the description is not working
@nicspyyАй бұрын
what problem are you facing exactly
@sehajmakkarrАй бұрын
@@nicspyy it is working now, and thankyou for the setup!
@saranathrajaram639Ай бұрын
Mingw setup problem what to do
@nicspyyАй бұрын
can you explain in brief
@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Ай бұрын
nice share
@nicspyyАй бұрын
Thanks bro
@RajinderSingh-tm8lnАй бұрын
bro it's asking for decryption key can u pls provide it the course is really helpful
@nicspyyАй бұрын
@@RajinderSingh-tm8ln i tried opening, it was not asking can you verify once
@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Ай бұрын
@@RajinderSingh-tm8ln is it issue with download, coz i tried both download and online stream it is working absolutely fine
@RajinderSingh-tm8lnАй бұрын
@@nicspyy should I share you the image asking for decryption key ??
@RajinderSingh-tm8lnАй бұрын
@@nicspyy bro pls help me out here ??
@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Ай бұрын
nicely explained
@nicspyyАй бұрын
@@ujjwalagrawalvideos thanks
@saurabhkr78Ай бұрын
error after ctrl+b The system cannot find the file specified. [Finished in 334ms]
@nicspyyАй бұрын
is ur folder structure same as mine
@RimoGhosh-p5bАй бұрын
why n - cnt ??
@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Ай бұрын
nice explanation
@nicspyyАй бұрын
@@manishkumar-uw5mw thanks 🌟
@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Ай бұрын
#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Ай бұрын
code of 3 please provide
@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Ай бұрын
@@nicspyy you are not allowed to use alt accounts on codeforces, now I understood why you haven't shared your CF ID
@nicspyyАй бұрын
@@Josuke217 who make this rule
@Josuke217Ай бұрын
@@nicspyy Mike Mirzayanov - creator of CF
@nicspyyАй бұрын
@@Josuke217 ohh !! but everyone makes
@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Ай бұрын
ohh !! yes i notice, i compare it with the 1st array, thanks ❤
@jayantdubey8398Ай бұрын
In the third question if values were values are 3333221 the it won't be areenged in non decreasing order
@nicspyyАй бұрын
@@jayantdubey8398 yes, that what i said, after 1 or 2 operation the arrya will be in accessing order
@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Ай бұрын
@@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Ай бұрын
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Ай бұрын
@@nicspyy got it.. thanks
@tej.askambleАй бұрын
@@parasjeeprep3206 thanks
@akashsuryavanshi7026Ай бұрын
Bro, great Explanation!!
@nicspyyАй бұрын
thanks
@kashmirtellerking827Ай бұрын
bhai pattern wale question nhi ho paate div 2 ka c jabki div 3 ka e ho jate h
@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Ай бұрын
if you print matrix into reverse order then the center element will not change its position wrong approach