Submission #1013132

# Submission time Handle Problem Language Result Execution time Memory
1013132 2024-07-03T08:17:11 Z vjudge1 Bubble Sort 2 (JOI18_bubblesort2) C++17
38 / 100
9000 ms 2360 KB
#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;
#define pb push_back

std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){
    int Q=X.size();
    std::vector<int> answer;
    int n=A.size();
    int dp[A.size()];
    dp[0]=0;
    for(int i=1;i<n;i++){
        dp[i]=0;
        for(int j=i-1;j>=0;j--){
            if(A[j]>A[i])
                dp[i]++;
        }
    }
    for(int i=0;i<Q;i++){
        dp[X[i]]=0;
        for(int j=X[i]-1;j>=0;j--){
            if(A[j]>V[i])
                dp[X[i]]++;
        }
        for(int j=X[i]+1;j<n;j++){
            if(V[i]>A[j] && A[j]>=A[X[i]])
                dp[j]++;
            else{
                if(V[i]<=A[j] && A[X[i]]>A[j])
                    dp[j]--;
            }
        }
        A[X[i]]=V[i];
        answer.pb(*max_element(dp,dp+n));
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 25 ms 552 KB Output is correct
4 Correct 25 ms 344 KB Output is correct
5 Correct 20 ms 488 KB Output is correct
6 Correct 15 ms 536 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 19 ms 536 KB Output is correct
9 Correct 20 ms 528 KB Output is correct
10 Correct 20 ms 604 KB Output is correct
11 Correct 17 ms 348 KB Output is correct
12 Correct 19 ms 348 KB Output is correct
13 Correct 16 ms 348 KB Output is correct
14 Correct 16 ms 348 KB Output is correct
15 Correct 16 ms 496 KB Output is correct
16 Correct 14 ms 348 KB Output is correct
17 Correct 15 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 25 ms 552 KB Output is correct
4 Correct 25 ms 344 KB Output is correct
5 Correct 20 ms 488 KB Output is correct
6 Correct 15 ms 536 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 19 ms 536 KB Output is correct
9 Correct 20 ms 528 KB Output is correct
10 Correct 20 ms 604 KB Output is correct
11 Correct 17 ms 348 KB Output is correct
12 Correct 19 ms 348 KB Output is correct
13 Correct 16 ms 348 KB Output is correct
14 Correct 16 ms 348 KB Output is correct
15 Correct 16 ms 496 KB Output is correct
16 Correct 14 ms 348 KB Output is correct
17 Correct 15 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
19 Correct 332 ms 848 KB Output is correct
20 Correct 413 ms 852 KB Output is correct
21 Correct 279 ms 892 KB Output is correct
22 Correct 327 ms 848 KB Output is correct
23 Correct 259 ms 840 KB Output is correct
24 Correct 262 ms 808 KB Output is correct
25 Correct 251 ms 1104 KB Output is correct
26 Correct 261 ms 848 KB Output is correct
27 Correct 209 ms 852 KB Output is correct
28 Correct 244 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1312 ms 860 KB Output is correct
2 Correct 6925 ms 1724 KB Output is correct
3 Execution timed out 9062 ms 2360 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 25 ms 552 KB Output is correct
4 Correct 25 ms 344 KB Output is correct
5 Correct 20 ms 488 KB Output is correct
6 Correct 15 ms 536 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 19 ms 536 KB Output is correct
9 Correct 20 ms 528 KB Output is correct
10 Correct 20 ms 604 KB Output is correct
11 Correct 17 ms 348 KB Output is correct
12 Correct 19 ms 348 KB Output is correct
13 Correct 16 ms 348 KB Output is correct
14 Correct 16 ms 348 KB Output is correct
15 Correct 16 ms 496 KB Output is correct
16 Correct 14 ms 348 KB Output is correct
17 Correct 15 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
19 Correct 332 ms 848 KB Output is correct
20 Correct 413 ms 852 KB Output is correct
21 Correct 279 ms 892 KB Output is correct
22 Correct 327 ms 848 KB Output is correct
23 Correct 259 ms 840 KB Output is correct
24 Correct 262 ms 808 KB Output is correct
25 Correct 251 ms 1104 KB Output is correct
26 Correct 261 ms 848 KB Output is correct
27 Correct 209 ms 852 KB Output is correct
28 Correct 244 ms 784 KB Output is correct
29 Correct 1312 ms 860 KB Output is correct
30 Correct 6925 ms 1724 KB Output is correct
31 Execution timed out 9062 ms 2360 KB Time limit exceeded
32 Halted 0 ms 0 KB -