c++ 解锁会增加内存消耗吗?

我写题习惯了用ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)解锁,但是今天在cf上写题的时候,交了好几遍都一直爆内存,最后发现是解锁的问题,相差了30倍,想问下为什么
题目链接:https://codeforces.com/contest/1833/problem/B

#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define f first
#define s second
void slove() {
    //IOS;去掉就对了 
    int n,k;
    cin >> n >> k;
    vector<pair<int,int> > a(n);
    vector<int> b(n);
    vector<int> ans(n); 
    for (int i = 0; i < n; i++) {
        cin >> a[i].f;
        a[i].s = i;
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    for (int i = 0; i < n; i++) {
        ans[a[i].s] = b[i];
    }
    for (int i = 0; i < n ;i++) {
        cout << ans[i] << " ";
    }
     cout << endl;
}
int main() {
    int tt;
    cin >> tt;
    while (tt--)  {
        slove();
    }
    return 0;
}