Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
I am the 1000th subscriber. Hope to see more of your content. Keep going buddy !!!
@@sashibhushanarajput1194 🎊🎊🎊🎊🎉🎉🎉🎉 thanks buddy
6:46 it should be 0110.
rigth
thanks a lot bro well explained!!
@@mohdkashif9830 thanks
Nice explanation.Thanks bhai!
thanks
How did the formula for C came ??? Dont call a "reading out" of solution an editorial.
I am not denying that proof is not there, but during contest I saw this pattern, so didn't aimed for finding proof also
brother youre doing really great . how can we perform good in contests
@@theslimeoxidizer3308 it's just "not giving up on a question to early" maybe 🤔
nice work brother
@@_hacker-rz2pk thanks
Great explanation brother
@@suryxnz thanks
please see this image for c's case with k==2 drive.google.com/file/d/1YTUALw1qMOlqAcJeX4855HkIq0pgIqXU/view?usp=sharingB solution:void solve() { int n; cin>>n; map mp; vpp a(n); set st; forn(i,0,n){ cin>>a[i].ff; cin>>a[i].ss; if(a[i].ff == a[i].ss){ st.insert(a[i].ff); mp[a[i].ff]++; } } vi temp (all(st)); vector ans(n); for(int i=0; i 1){ ans[i] = 0; }else{ ans[i] = 1; } }else{ int ind1 = lower_bound(all(temp), a[i].ff) - temp.begin(); int ind2 = lower_bound(all(temp), a[i].ss) - temp.begin(); if(ind1 != temp.size() and ind2 != temp.size() and temp[ind1] == a[i].ff and temp[ind2] == a[i].ss and ind2-ind1+1 == a[i].ss - a[i].ff + 1 ){ ans[i] = 0; }else{ ans[i] = 1; } } } for(auto i: ans){ coutk; cout q; vector v1 , v2; for(int i = 0 ; i < n ; i ++ ){ cin >> a[i]; v1.pb(a[i]); } for(int i = 0 ; i < n ; i ++ ){ cin >> b[i]; v2.pb(b[i]); } sort(v1.begin() , v1.end()); sort(v2.begin() , v2.end()); map lastA , lastB , cntA , cntB; int res = 1; for(int i = 0 ; i < n ; i ++ ){ lastA[v1[i]] = i; lastB[v2[i]] = i; cntA[v1[i]] ++ ; cntB[v2[i]] ++ ; res = res * min(v1[i] , v2[i]); res = res % mod; } vector ans; ans.pb(res); while(q--){ int type, ind; cin>>type>>ind; ind-- ; if(type == 1){ int x = a[ind]; int i = lastA[x]; cntA[x]--; if(cntA[x] == 0) lastA[x] = -1; else lastA[x]--; res = (res * powmod(min(v1[i] , v2[i]) , mod-2)) % mod; v1[i]++; a[ind]++; cntA[v1[i]]++; if(cntA[v1[i]] == 1) lastA[a[ind]] = i; res = res*min(v1[i] , v2[i]); res %= mod; } else{ int x = b[ind]; int i = lastB[x]; cntB[x] -- ; if(cntB[x] == 0) lastB[x] = 0; else lastB[x] -- ; res = res * powmod(min(v1[i] , v2[i]) , mod - 2) % mod; v2[i]++; b[ind]++; cntB[v2[i]]++; if(cntB[v2[i]] == 1) lastB[b[ind]] = i; res = res *min(v1[i] , v2[i]); res %= mod; } ans.pb(res); } for(auto x : ans) cout
I am the 1000th subscriber. Hope to see more of your content. Keep going buddy !!!
@@sashibhushanarajput1194 🎊🎊🎊🎊🎉🎉🎉🎉 thanks buddy
6:46 it should be 0110.
rigth
thanks a lot bro well explained!!
@@mohdkashif9830 thanks
Nice explanation.
Thanks bhai!
thanks
How did the formula for C came ???
Dont call a "reading out" of solution an editorial.
I am not denying that proof is not there, but during contest I saw this pattern, so didn't aimed for finding proof also
brother youre doing really great . how can we perform good in contests
@@theslimeoxidizer3308 it's just "not giving up on a question to early" maybe 🤔
nice work brother
@@_hacker-rz2pk thanks
Great explanation brother
@@suryxnz thanks
please see this image for c's case with k==2
drive.google.com/file/d/1YTUALw1qMOlqAcJeX4855HkIq0pgIqXU/view?usp=sharing
B solution:
void solve() {
int n;
cin>>n;
map mp;
vpp a(n);
set st;
forn(i,0,n){
cin>>a[i].ff;
cin>>a[i].ss;
if(a[i].ff == a[i].ss){
st.insert(a[i].ff);
mp[a[i].ff]++;
}
}
vi temp (all(st));
vector ans(n);
for(int i=0; i 1){
ans[i] = 0;
}else{
ans[i] = 1;
}
}else{
int ind1 = lower_bound(all(temp), a[i].ff) - temp.begin();
int ind2 = lower_bound(all(temp), a[i].ss) - temp.begin();
if(ind1 != temp.size() and ind2 != temp.size() and
temp[ind1] == a[i].ff and temp[ind2] == a[i].ss
and ind2-ind1+1 == a[i].ss - a[i].ff + 1
){
ans[i] = 0;
}else{
ans[i] = 1;
}
}
}
for(auto i: ans){
coutk;
cout q;
vector v1 , v2;
for(int i = 0 ; i < n ; i ++ ){
cin >> a[i];
v1.pb(a[i]);
}
for(int i = 0 ; i < n ; i ++ ){
cin >> b[i];
v2.pb(b[i]);
}
sort(v1.begin() , v1.end());
sort(v2.begin() , v2.end());
map lastA , lastB , cntA , cntB;
int res = 1;
for(int i = 0 ; i < n ; i ++ ){
lastA[v1[i]] = i;
lastB[v2[i]] = i;
cntA[v1[i]] ++ ;
cntB[v2[i]] ++ ;
res = res * min(v1[i] , v2[i]);
res = res % mod;
}
vector ans;
ans.pb(res);
while(q--){
int type, ind;
cin>>type>>ind;
ind-- ;
if(type == 1){
int x = a[ind];
int i = lastA[x];
cntA[x]--;
if(cntA[x] == 0) lastA[x] = -1;
else lastA[x]--;
res = (res * powmod(min(v1[i] , v2[i]) , mod-2)) % mod;
v1[i]++;
a[ind]++;
cntA[v1[i]]++;
if(cntA[v1[i]] == 1) lastA[a[ind]] = i;
res = res*min(v1[i] , v2[i]);
res %= mod;
}
else{
int x = b[ind];
int i = lastB[x];
cntB[x] -- ;
if(cntB[x] == 0) lastB[x] = 0;
else lastB[x] -- ;
res = res * powmod(min(v1[i] , v2[i]) , mod - 2) % mod;
v2[i]++;
b[ind]++;
cntB[v2[i]]++;
if(cntB[v2[i]] == 1) lastB[b[ind]] = i;
res = res *min(v1[i] , v2[i]);
res %= mod;
}
ans.pb(res);
}
for(auto x : ans) cout