Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
❤
Thanks a lot for your help
@@dewsara2888 welcome 😎
great explanation buddyyyy
thanks bro❤❤
C solution:void solve(){ int n; cin>>n; string s; cin>>s; map mp; for(auto &i: s) mp[i]++; priority_queue pq; for(auto i: mp){ pq.push({ i.second, i.first }); } vector 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 m; int secMex = 0; while(x--){ int n; cin>>n; set 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
cf id????
❤
Thanks a lot for your help
@@dewsara2888 welcome 😎
great explanation buddyyyy
thanks bro❤❤
C solution:
void solve(){
int n;
cin>>n;
string s;
cin>>s;
map mp;
for(auto &i: s) mp[i]++;
priority_queue pq;
for(auto i: mp){
pq.push({ i.second, i.first });
}
vector 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 m;
int secMex = 0;
while(x--){
int n;
cin>>n;
set 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
cf id????