Skip to content

Commit daeb81f

Browse files
committed
Added 1833B - Restore the Weather.cpp
1 parent 3e60dc2 commit daeb81f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

1833B - Restore the Weather.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define ll long long
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
int n, k;
16+
cin>>n>>k;
17+
18+
vector<pair<int, int>> a(n);
19+
vector<int> b(n);
20+
for(int i=0; i<n; i++)
21+
{
22+
cin>>a[i].first;
23+
a[i].second = i;
24+
}
25+
for(int i=0; i<n; i++)
26+
{
27+
cin>>b[i];
28+
}
29+
sort(a.begin(), a.end());
30+
sort(b.begin(), b.end());
31+
vector <int> ans(n);
32+
for(int i=0; i<n; i++)
33+
{
34+
ans[a[i].second] = b[i];
35+
}
36+
for(auto i : ans)
37+
{
38+
cout<<i<<" ";
39+
}
40+
cout<<endl;
41+
}
42+
return 0;
43+
}

0 commit comments

Comments
 (0)