/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 556.0 KiB
#2 Accepted 133ms 796.0 KiB
#3 Accepted 109ms 1.18 MiB
#4 Accepted 103ms 948.0 KiB
#5 Accepted 162ms 7.949 MiB
#6 Accepted 219ms 7.773 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sp " "
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl
#define no cout << "no" << endl

void messi()
{
    ll n;
    cin >> n;
    ll a[n];
    set<pair<ll, ll>> v;
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        v.insert({a[i], i});
    }
    ll q;
    cin >> q;
    while (q--)
    {
        ll x;
        cin >> x;
        auto in = *v.begin();
        cout << in.second + 1 << endl;
        v.erase(in);
        a[in.second] = x;
        v.insert({x, in.second});
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll tc = 1; // cin>>tc;
    while (tc--)
    {
        messi();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1086 KuZ the Position
Contest
Bangladesh 2.0
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-16 16:22:20
Judged At
2024-08-16 16:22:20
Judged By
Score
100
Total Time
219ms
Peak Memory
7.949 MiB