Submission #62533474


Source Code Expand

Copy
/*
*/
// author: dheeraj
#include <bits/stdc++.h>
#include <vector>
#include<set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <iterator>
#include <climits> // For LONG_LONG_MAX
#include <iomanip> // For fixed and setprecision if needed
#include <numeric> // For accumulate
#include <sstream> // For stringstream
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
/*

*/

// author: dheeraj
#include <bits/stdc++.h>
#include <vector>
#include<set>

#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <iterator>
#include <climits> // For LONG_LONG_MAX
#include <iomanip> // For fixed and setprecision if needed
#include <numeric> // For accumulate
#include <sstream> // For stringstream

using namespace std;

#define Code ios_base::sync_with_stdio(false);
#define By cin.tie(NULL);
#define Asquare cout.tie(NULL);

typedef long long ll;
typedef long double lld;
typedef unsigned long long ull;

const lld pi = 3.141592653589793238;
// const ll INF = LONG_LONG_MAX;
const ll mod = 1e9 + 7;

typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef unordered_map<ll, ll> umll;
typedef map<ll, ll> mll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define fl(i, n) for (int i = 0; i < n; i++)
#define rl(i, m, n) for (int i = n; i >= m; i--)
#define py cout << "YES\n";
#define pm cout << "-1\n";
#define pn cout << "NO\n";
#define vr(v) v.begin(), v.end()
#define rv(v) v.end(), v.begin()

template <typename T1, typename T2>
istream &operator>>(istream &istream, pair<T1, T2> &p) {
    return (istream >> p.first >> p.second);
}

template <typename T1, typename T2>
ostream &operator<<(ostream &ostream, const pair<T1, T2> &p) {
    return (ostream << p.first << " " << p.second);
}

template <typename T>
void print(const T &t) {
    cout << t << "\n";
}

void printarr(ll arr[], ll n) {
    fl(i, n) cout << arr[i] << " ";
    cout << "\n";
}

template <typename T>
void printvec(const vector<T> &v) {
    for (typename vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
        cout << *it << " ";
    }
    cout << "\n";
}

template <typename T>
ll sumvec(const vector<T> &v) {
    ll s = 0;
    fl(i, v.size()) s += v[i];
    return s;
}

ll gcd(ll a, ll b) { return (b == 0) ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll moduloMultiplication(ll a, ll b, ll mod) {
    ll res = 0;
    a %= mod;
    while (b) {
        if (b & 1) res = (res + a) % mod;
        b >>= 1;
        a = (a * 2) % mod;
    }
    return res;
}
ll powermod(ll x, ll y, ll p) {
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

bool sorta(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }
bool sortd(const pair<int, int> &a, const pair<int, int> &b) { return (a.second > b.second); }

string decToBinary(int n) {
    string s = "";
    while (n > 0) {
        s = to_string(n % 2) + s;
        n = n / 2;
    }
    return s;
}

ll binaryToDecimal(const string &n) {
    ll dec_value = 0;
    int base = 1;
    int len = n.length();
    for (int i = len - 1; i >= 0; i--) {
        if (n[i] == '1') dec_value += base;
        base = base * 2;
    }
    return dec_value;
}

bool isPrime(ll n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0) return false;
    return true;
}
bool isPowerOfTwo(int n) { return (n && !(n & (n - 1))); }
bool isPerfectSquare(ll x) {
    if (x >= 0) {
        ll sr = sqrt(x);
        return (sr * sr == x);
    }
    return false;
}

void getPrime(ll p, map < ll, ll >&ma){ 
    while(p%2 == 0) {
        ma[2]++;
        p/=2;
    }
    for(ll i = 3; i <= sqrt(p); i++) {
        while(p%i == 0) {
            ma[i]++;
            p/=i;
        }
    }
    if(p > 1)
        ma[p]++;
}
void solve() {
 
 int  n;
cin>>n;

vector<int>p(n);
vector<int>q(n);
map<int,int>m;

for(int i=0;i<n;i++)
cin>>p[i];


for(int i=0;i<n;i++)
cin>>q[i];

for(int i=0;i<n;i++)
{
    m[q[i]]=p[i];
}


for(int i=1;i<=n;i++)
{
    int ind=m[i];
    cout<<q[ind-1]<<" ";
}
cout<<endl;




}

int main()
{   
   
    ll t=1;
    // cin>>t;
   
   while(t--)
   {
       solve();
   }
 }

Submission Info

Submission Time
Task C - Bib
User dheeraj_001
Language C++ 20 (gcc 12.2)
Score 300
Code Size 4347 Byte
Status AC
Exec Time 343 ms
Memory 19564 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 13
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
min.txt AC 1 ms 3380 KB
random_01.txt AC 312 ms 19500 KB
random_02.txt AC 6 ms 3984 KB
random_03.txt AC 321 ms 19432 KB
random_04.txt AC 27 ms 5436 KB
random_05.txt AC 320 ms 19564 KB
random_06.txt AC 55 ms 7340 KB
random_07.txt AC 306 ms 19456 KB
random_08.txt AC 279 ms 18092 KB
random_09.txt AC 343 ms 19548 KB
random_10.txt AC 114 ms 10560 KB
sample_01.txt AC 1 ms 3416 KB
sample_02.txt AC 1 ms 3492 KB


2025-04-05 (Sat)
16:23:02 +00:00