This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bubblesort2.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <algorithm>
#include <iostream>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
int Q=X.size();
int n = A.size();
std::vector<int> answer(Q);
orderedSet s;
vector<pair<int, int> > crt;
for (int i = 0; i < Q; i++)
{
A[X[i]] = V[i];
// cout << X[i] << ' ' << V[i] << '\n';
vector<pair<int , int> > nou(n);
for (int j = 0; j < n; j++)
{
nou[j] = {A[j] , j};
// cout << A[j] << ' ';
}
sort(nou.begin(), nou.end());
for (int j = 0; j < n; j++)
{
answer[i] = max(answer[i] , nou[j].second - j);
}
}
return answer;
}
# | 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... |