Submission #884038

#TimeUsernameProblemLanguageResultExecution timeMemory
884038vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
38 / 100
9062 ms1368 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...