Submission #251511

#TimeUsernameProblemLanguageResultExecution timeMemory
251511test2Bubble Sort 2 (JOI18_bubblesort2)C++14
38 / 100
9003 ms2600 KiB
#include<bits/stdc++.h>
#include "bubblesort2.h"

using namespace std ; 

int n; 

std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
	int Q=X.size();
        n = (int) A.size() ; 
	std::vector<int> answer(Q);
	for (int j=0;j<Q;j++) {
		A[ X[j] ] = V[ j ] ; 
                vector<pair<int , int > > tmp ; 
                int ret = 0 ; 
                for(int i = 0 ; i < n ;i++){
                        tmp.push_back({A[i] , i}) ; 
                }
                sort(tmp.begin() , tmp.end()) ; 
                for(int i = 0 ;i < n ;i++){
                        ret = max(ret , tmp[i].second - i) ; 
                }
                answer[j] = ret ; 
	}
	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...