Submission #421924

# Submission time Handle Problem Language Result Execution time Memory
421924 2021-06-09T13:50:39 Z 반딧불(#7622) Bubble Sort 2 (JOI18_bubblesort2) C++17
38 / 100
9000 ms 2560 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++){
            ret = max(ret, i - tarr[i]);
        }

        ans.push_back(ret);
    }
    return ans;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:24:22: warning: unused variable 'cnt' [-Wunused-variable]
   24 |         int ret = 0, cnt = 0;
      |                      ^~~
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 47 ms 372 KB Output is correct
3 Correct 291 ms 440 KB Output is correct
4 Correct 291 ms 456 KB Output is correct
5 Correct 273 ms 440 KB Output is correct
6 Correct 199 ms 444 KB Output is correct
7 Correct 262 ms 568 KB Output is correct
8 Correct 267 ms 440 KB Output is correct
9 Correct 276 ms 444 KB Output is correct
10 Correct 198 ms 436 KB Output is correct
11 Correct 187 ms 452 KB Output is correct
12 Correct 187 ms 452 KB Output is correct
13 Correct 185 ms 440 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 191 ms 444 KB Output is correct
16 Correct 177 ms 436 KB Output is correct
17 Correct 176 ms 452 KB Output is correct
18 Correct 168 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 47 ms 372 KB Output is correct
3 Correct 291 ms 440 KB Output is correct
4 Correct 291 ms 456 KB Output is correct
5 Correct 273 ms 440 KB Output is correct
6 Correct 199 ms 444 KB Output is correct
7 Correct 262 ms 568 KB Output is correct
8 Correct 267 ms 440 KB Output is correct
9 Correct 276 ms 444 KB Output is correct
10 Correct 198 ms 436 KB Output is correct
11 Correct 187 ms 452 KB Output is correct
12 Correct 187 ms 452 KB Output is correct
13 Correct 185 ms 440 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 191 ms 444 KB Output is correct
16 Correct 177 ms 436 KB Output is correct
17 Correct 176 ms 452 KB Output is correct
18 Correct 168 ms 332 KB Output is correct
19 Correct 4078 ms 828 KB Output is correct
20 Correct 5362 ms 880 KB Output is correct
21 Correct 4656 ms 964 KB Output is correct
22 Correct 5198 ms 996 KB Output is correct
23 Correct 3477 ms 848 KB Output is correct
24 Correct 3471 ms 868 KB Output is correct
25 Correct 3421 ms 844 KB Output is correct
26 Correct 3570 ms 968 KB Output is correct
27 Correct 3460 ms 864 KB Output is correct
28 Correct 3506 ms 844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6881 ms 1560 KB Output is correct
2 Execution timed out 9072 ms 2560 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 47 ms 372 KB Output is correct
3 Correct 291 ms 440 KB Output is correct
4 Correct 291 ms 456 KB Output is correct
5 Correct 273 ms 440 KB Output is correct
6 Correct 199 ms 444 KB Output is correct
7 Correct 262 ms 568 KB Output is correct
8 Correct 267 ms 440 KB Output is correct
9 Correct 276 ms 444 KB Output is correct
10 Correct 198 ms 436 KB Output is correct
11 Correct 187 ms 452 KB Output is correct
12 Correct 187 ms 452 KB Output is correct
13 Correct 185 ms 440 KB Output is correct
14 Correct 208 ms 332 KB Output is correct
15 Correct 191 ms 444 KB Output is correct
16 Correct 177 ms 436 KB Output is correct
17 Correct 176 ms 452 KB Output is correct
18 Correct 168 ms 332 KB Output is correct
19 Correct 4078 ms 828 KB Output is correct
20 Correct 5362 ms 880 KB Output is correct
21 Correct 4656 ms 964 KB Output is correct
22 Correct 5198 ms 996 KB Output is correct
23 Correct 3477 ms 848 KB Output is correct
24 Correct 3471 ms 868 KB Output is correct
25 Correct 3421 ms 844 KB Output is correct
26 Correct 3570 ms 968 KB Output is correct
27 Correct 3460 ms 864 KB Output is correct
28 Correct 3506 ms 844 KB Output is correct
29 Correct 6881 ms 1560 KB Output is correct
30 Execution timed out 9072 ms 2560 KB Time limit exceeded
31 Halted 0 ms 0 KB -