Submission #389712

# Submission time Handle Problem Language Result Execution time Memory
389712 2021-04-14T12:00:46 Z muhammad_hokimiyon Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
6945 ms 908 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){
	int Q=X.size();
	vector<int> answer;
	int n = (int)A.size();
    for(int i = 0; i < Q; i++){
        A[X[i]] = V[i];
        auto b = A;
        sort(b.begin(), b.end());
        map<int, deque<int>> p;
        for(int j = 0; j < n; j++){
            p[A[j]].push_back(j);
        }
        int res = 0;
        for(int j = 0; j < n; j++){
            res = max(res, abs(p[b[j]][0] - j));
            p[b[j]].pop_front();
        }
        answer.push_back(res);
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 704 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6945 ms 908 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 704 KB Output isn't correct
2 Halted 0 ms 0 KB -