/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 183ms 752.0 KiB
#3 Accepted 195ms 924.0 KiB
#4 Accepted 192ms 924.0 KiB
#5 Accepted 265ms 7.891 MiB
#6 Accepted 268ms 7.797 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-10-03 13:27:18
Judged By
Score
100
Total Time
268ms
Peak Memory
7.891 MiB