Ultraviolet A 501, ultraviolet
Link to the question: Ultraviolet A 501-Black Box
There is a set in which the given elements enter the order of the set. Now there are Q queries. Given that each query enters the set after the first few elements, for each I query, the number of I in the output set.
Solution: Use two priority queues for maintenance. If queue a has a higher priority value and queue B has a lower priority value, before the I-th inquiry, ensure that a queue has I-1 element elements, and the rest is smaller than B, then each time you ask to output the first element of B queue, and put it in queue.
#include <cstdio>#include <cstring>#include <queue>#include <algorithm>using namespace std;const int maxn = 30005;int N, M, arr[maxn], v[maxn];void solve () { priority_queue<int> a; priority_queue<int, vector<int>, greater<int> > b; for (int i = 1; i <= N; i++) { a.push(arr[i]); b.push(a.top()); a.pop(); while (v[i]--) { printf("%d\n", b.top()); a.push(b.top()); b.pop(); } }}int main () { int cas; scanf("%d", &cas); while (cas--) { int x; memset(v, 0, sizeof(v)); scanf("%d%d", &N, &M); for (int i = 1; i <= N; i++) scanf("%d", &arr[i]); for (int i = 0; i < M; i++) { scanf("%d", &x); v[x]++; } solve(); if (cas) printf("\n"); } return 0;}
I want to go swimming with my friends in Rizhao these days. I'm so excited to look forward to hearing from my friends about the good effects of sijel sunscreen bought from Shenzhen.
I guess you also bought it in a thousand-color store? I have just bought rul sunscreen from a thousand-color store a few days ago. I want to teach you how to repeat it. It is very important to repeat it every two hours. It has nothing to do with water resistance, it is because of the variability, diversity, and extent of various indoor and outdoor activities, such as swimming, surfing, sweating, towel drying, wearing and removing clothes, playing on the beach, etc, it can cause the sunscreen to be erased and removed from the skin, which will affect the efficacy of the sunscreen and reduce the protection of the sunscreen against ultraviolet A/ultraviolet B.
What kind of sunscreen is better?
1. za isolation, which completely protects against sun protection. The sunscreen index is 26, which defends against both ultraviolet and ultraviolet rays and moisturizes the image. RMB68
2. Nivea: there are many kinds of sun protection in their house. They are also very good at it. I used to use it as a body for sun protection.
LZ can go and check it and recommend it to bar.
3, DHC sunscreen, now special offer, RMB98, no added, more skin is good
4. The city block of Clinique is isolated, and the effect is very good. The amount of data used each time is very small. Therefore, it can be used for a long time. It is very expensive and has more than 200 points.
Hope to help LZ