Submission #105214

# Submission time Handle Problem Language Result Execution time Memory
105214 2019-04-11T02:20:41 Z silxikys Bubble Sort 2 (JOI18_bubblesort2) C++14
38 / 100
9000 ms 2716 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;

const int maxn = 5e5+5;
int N;

void pr(const vector<int>& A) {
    for (int i: A) cout << i << ' ';
    cout << '\n';
}

int solve(const vector<int>& A) {
    //pr(A);
    vector<pair<int,int>> ps;
    for (int i = 0; i < N; i++) ps.push_back({A[i],i});
    sort(ps.begin(),ps.end());
    int ans = 0;
    for (int i = 0; i < N; i++) {
        int ord = i;
        if (ord < ps[i].second) ans = max(ans,ps[i].second-ord);
    }
    return ans;
}

vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
    N = A.size();
	int Q = X.size();
	vector<int> answer(Q);
    //brute method
    for (int i = 0; i < Q; i++) {
        A[X[i]] = V[i];
        answer[i] = solve(A);
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 41 ms 384 KB Output is correct
3 Correct 250 ms 512 KB Output is correct
4 Correct 245 ms 512 KB Output is correct
5 Correct 271 ms 632 KB Output is correct
6 Correct 174 ms 488 KB Output is correct
7 Correct 214 ms 504 KB Output is correct
8 Correct 258 ms 504 KB Output is correct
9 Correct 263 ms 384 KB Output is correct
10 Correct 169 ms 504 KB Output is correct
11 Correct 159 ms 516 KB Output is correct
12 Correct 179 ms 604 KB Output is correct
13 Correct 156 ms 384 KB Output is correct
14 Correct 152 ms 384 KB Output is correct
15 Correct 167 ms 512 KB Output is correct
16 Correct 163 ms 568 KB Output is correct
17 Correct 159 ms 384 KB Output is correct
18 Correct 157 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 41 ms 384 KB Output is correct
3 Correct 250 ms 512 KB Output is correct
4 Correct 245 ms 512 KB Output is correct
5 Correct 271 ms 632 KB Output is correct
6 Correct 174 ms 488 KB Output is correct
7 Correct 214 ms 504 KB Output is correct
8 Correct 258 ms 504 KB Output is correct
9 Correct 263 ms 384 KB Output is correct
10 Correct 169 ms 504 KB Output is correct
11 Correct 159 ms 516 KB Output is correct
12 Correct 179 ms 604 KB Output is correct
13 Correct 156 ms 384 KB Output is correct
14 Correct 152 ms 384 KB Output is correct
15 Correct 167 ms 512 KB Output is correct
16 Correct 163 ms 568 KB Output is correct
17 Correct 159 ms 384 KB Output is correct
18 Correct 157 ms 632 KB Output is correct
19 Correct 3649 ms 848 KB Output is correct
20 Correct 4506 ms 1016 KB Output is correct
21 Correct 4170 ms 1020 KB Output is correct
22 Correct 4625 ms 1016 KB Output is correct
23 Correct 2907 ms 876 KB Output is correct
24 Correct 2736 ms 868 KB Output is correct
25 Correct 2938 ms 1016 KB Output is correct
26 Correct 2806 ms 1016 KB Output is correct
27 Correct 2923 ms 1016 KB Output is correct
28 Correct 2890 ms 896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6356 ms 1548 KB Output is correct
2 Execution timed out 9003 ms 2716 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 41 ms 384 KB Output is correct
3 Correct 250 ms 512 KB Output is correct
4 Correct 245 ms 512 KB Output is correct
5 Correct 271 ms 632 KB Output is correct
6 Correct 174 ms 488 KB Output is correct
7 Correct 214 ms 504 KB Output is correct
8 Correct 258 ms 504 KB Output is correct
9 Correct 263 ms 384 KB Output is correct
10 Correct 169 ms 504 KB Output is correct
11 Correct 159 ms 516 KB Output is correct
12 Correct 179 ms 604 KB Output is correct
13 Correct 156 ms 384 KB Output is correct
14 Correct 152 ms 384 KB Output is correct
15 Correct 167 ms 512 KB Output is correct
16 Correct 163 ms 568 KB Output is correct
17 Correct 159 ms 384 KB Output is correct
18 Correct 157 ms 632 KB Output is correct
19 Correct 3649 ms 848 KB Output is correct
20 Correct 4506 ms 1016 KB Output is correct
21 Correct 4170 ms 1020 KB Output is correct
22 Correct 4625 ms 1016 KB Output is correct
23 Correct 2907 ms 876 KB Output is correct
24 Correct 2736 ms 868 KB Output is correct
25 Correct 2938 ms 1016 KB Output is correct
26 Correct 2806 ms 1016 KB Output is correct
27 Correct 2923 ms 1016 KB Output is correct
28 Correct 2890 ms 896 KB Output is correct
29 Correct 6356 ms 1548 KB Output is correct
30 Execution timed out 9003 ms 2716 KB Time limit exceeded
31 Halted 0 ms 0 KB -