Submission #924527

# Submission time Handle Problem Language Result Execution time Memory
924527 2024-02-09T07:21:58 Z 12345678 Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
1194 ms 788 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>

using namespace std;

const int nx=5e5+5;
int dp[nx];

std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
	int Q=X.size(), N=A.size();
	for (int i=0; i<N; i++) dp[i]=0;
	vector<int> answer(Q);
	for (int i=0; i<N; i++) for (int j=0; j<i; j++) if (A[j]>A[i]) dp[i]++;
	for (int i=0; i<Q; i++) {
		int idx=X[i], vl=V[i], ans=0;
		for (int j=idx+1; j<N; j++) if (A[idx]>A[j]) dp[j]--;
		dp[idx]=0;
		A[idx]=vl;
		for (int j=0; j<idx; j++) if (A[j]>A[idx]) dp[idx]++;
		for (int j=0; j<N; j++) ans=max(ans, dp[j]);
		answer[i]=ans;
	}
	return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1194 ms 788 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -