My issue
I can not understand the problem.Can anyone help me?
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: ORST Practice Coding Problem - CodeChef
I can not understand the problem.Can anyone help me?
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
}
Problem Link: ORST Practice Coding Problem - CodeChef
@nionroy
plzz refer my c++ code for better understanding of the logic
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
int a[n],b[m];
priority_queue<int,vector<int>,greater<int>> pq;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
int mx=0;
for(int i=0;i<m;i++)
{
cin>>b[i];
mx=max(mx,b[i]);
}
int n1=n-mx;
for(int i=0;i<n1;i++)
{
cout<<a[i]<<" ";
}
for(int i=n1;i<n;i++)
{
pq.push(a[i]);
}
while(!pq.empty())
{
cout<<pq.top()<<" ";
pq.pop();
}
cout<<endl;
}
}