Submission #421666

# Submission time Handle Problem Language Result Execution time Memory
421666 2021-06-09T10:40:00 Z 반딧불(#7622) Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
7070 ms 1824 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, q;
vector<pair<int, int> > vec;
int arr[500002];
int tarr[500002];
int chk[500002];
vector<int> ans;

vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
	n = (int)A.size();
	q = (int)X.size();
	for(int i=1; i<=n; i++){
        arr[i] = A[i-1];
	}

    for(int i=0; i<q; i++){
        arr[X[i]+1] = V[i];
        int ret = 0, cnt = 0;

        vector<pair<int, int> > vec;
        for(int i=1; i<=n; i++){
            vec.push_back(make_pair(arr[i], i));
        }
        sort(vec.begin(), vec.end());
        for(int i=1; i<=n; i++) tarr[vec[i-1].second] = i;


        for(int i=1; i<=n; i++) chk[i] = 0;
        for(int i=1; i<=n; i++){
            if(tarr[i] <= i-cnt){
                cnt -= chk[i];
                continue;
            }
            cnt -= chk[i];
            cnt++;
            ret = max(ret, cnt);
            chk[tarr[i]]++;
        }

        ans.push_back(ret);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7070 ms 1824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -