#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll mmod = 998244353;
#define vl vector<long long>
#define vll vector<vector<long long>>
#define pl pair<long long, long long>
#define vb vector<bool>
std::vector<int> ucs(std::vector<int> A, std::vector<int> B){
ll n = A.size();
multiset<ll> m;
for (ll i = 0; i < B.size(); i++){
m.insert(B[i]);
}
vector<int> ans;
ll ukazatel = 0;
for (ll i = 0; i < n; i++){
ll prvek = A[i];
auto it = m.find(prvek);
if (it != m.end()){
ans.push_back(prvek);
while (B[ukazatel] != prvek){
it = m.find(B[ukazatel]);
m.erase(it);
ukazatel++;
if (ukazatel >= B.size()){
ukazatel --;
break;
}
}
it = m.find(B[ukazatel]);
m.erase(it);
}
}
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |