/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 632.0 KiB
#2 Accepted 16ms 532.0 KiB
#3 Accepted 19ms 776.0 KiB
#4 Accepted 19ms 792.0 KiB
#5 Accepted 34ms 3.656 MiB
#6 Accepted 38ms 3.391 MiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e5 + 10;
const ll MOD = 1e9 + 7;

void solve()
{
  ll n;
  cin >> n;
  
  vector<ll> v(n);
  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>> > pq;
  for(ll i = 0; i < n; i++) {
    cin >> v[i];
    pq.push({v[i], i + 1});
  }
  
  ll q;
  cin >> q;
  while(q--) {
    ll p;
    cin >> p;
    auto temp = pq.top();
    pq.pop();
    cout << temp.second << "\n";
    pq.push({p, temp.second});
  }
}

int main()
{
  ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  solve();
}

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 15:41:25
Judged At
2024-08-16 15:41:25
Judged By
Score
100
Total Time
38ms
Peak Memory
3.656 MiB