/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 412.0 KiB
#2 Accepted 149ms 744.0 KiB
#3 Accepted 163ms 968.0 KiB
#4 Accepted 158ms 1004.0 KiB
#5 Accepted 260ms 7.988 MiB
#6 Accepted 278ms 7.984 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-11-11 03:15:00
Judged By
Score
100
Total Time
278ms
Peak Memory
7.988 MiB