update code

This commit is contained in:
ShazidMahsrafi 2024-06-24 23:03:40 +06:00
parent b62e5e7c9e
commit f9b5b3927f

View File

@ -15,16 +15,13 @@ void solve()
{ {
int x; int x;
cin>>x; cin>>x;
st.insert(x); st.insert(x-1);
} }
cin>>c; cin>>c;
sort(c.begin(),c.end()); sort(c.begin(),c.end());
vector<int>v; int i=0;
for(auto x:st) v.push_back(x); for(auto x:st)
for(int i=0; i<st.size(); ++i) s[x]=c[i++];
{
s[v[i]-1] = c[i];
}
cout<<s<<endl; cout<<s<<endl;
} }