Submission #1012103

# Submission time Handle Problem Language Result Execution time Memory
1012103 2024-07-01T16:09:20 Z vjudge1 Bubble Sort 2 (JOI18_bubblesort2) C++17
38 / 100
9000 ms 2428 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
using lli=long long int;
#define endl '\n'


vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){
	int n=A.size();
    int q=X.size();
    vector<int> sv;
    vector<int> val (n);
    for(int j=0; j<n; ++j){
        int aux=0;
        for(int k=0; k<j; ++k){
            if(A[k]>A[j]){
                aux++;
            }
        }
        val[j]=aux;
    }
    for(int i=0; i<q; ++i){

        for(int j=0; j<X[i]; ++j){
            if(A[j]>A[X[i]]){
                val[X[i]]--;
            }
            if(A[j]>V[i]){
                val[X[i]]++;
            }
        }
        for(int j=X[i]+1; j<n; ++j){
            if(A[X[i]]>A[j]){
                val[j]--;
            }
            if(V[i]>A[j]){
                val[j]++;
            }
        }
        int ans=0;
        for(int x: val){
            ans=max(ans, x);
        }
        sv.pb(ans);
        A[X[i]]=V[i];

    }
    return sv;
}



//Grader Malo
/*
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    lli t=1;
    //cin>>t;
    while(t--){
      int n,q;
      cin>>n>>q;
      vector<int> A (n);
      for(int i=0; i<n; ++i){
        cin>>A[i];
      }
      vector<int> X(q);
      vector<int> V(q);
      for(int i=0; i<q; ++i){
        cin>>X[i]>>V[i];
      }
      vector<int> ans=countScans(A,X,V);
      for(int x: ans){
        cout<<x<<endl;
      }
    }
}*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 24 ms 552 KB Output is correct
4 Correct 24 ms 552 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 11 ms 348 KB Output is correct
7 Correct 14 ms 536 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Correct 19 ms 348 KB Output is correct
10 Correct 15 ms 540 KB Output is correct
11 Correct 20 ms 532 KB Output is correct
12 Correct 14 ms 348 KB Output is correct
13 Correct 14 ms 444 KB Output is correct
14 Correct 14 ms 492 KB Output is correct
15 Correct 14 ms 544 KB Output is correct
16 Correct 13 ms 540 KB Output is correct
17 Correct 12 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 24 ms 552 KB Output is correct
4 Correct 24 ms 552 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 11 ms 348 KB Output is correct
7 Correct 14 ms 536 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Correct 19 ms 348 KB Output is correct
10 Correct 15 ms 540 KB Output is correct
11 Correct 20 ms 532 KB Output is correct
12 Correct 14 ms 348 KB Output is correct
13 Correct 14 ms 444 KB Output is correct
14 Correct 14 ms 492 KB Output is correct
15 Correct 14 ms 544 KB Output is correct
16 Correct 13 ms 540 KB Output is correct
17 Correct 12 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
19 Correct 258 ms 824 KB Output is correct
20 Correct 329 ms 852 KB Output is correct
21 Correct 199 ms 860 KB Output is correct
22 Correct 260 ms 852 KB Output is correct
23 Correct 209 ms 804 KB Output is correct
24 Correct 214 ms 812 KB Output is correct
25 Correct 199 ms 808 KB Output is correct
26 Correct 189 ms 852 KB Output is correct
27 Correct 197 ms 804 KB Output is correct
28 Correct 191 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 503 ms 868 KB Output is correct
2 Correct 5433 ms 1808 KB Output is correct
3 Execution timed out 9021 ms 2428 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 348 KB Output is correct
3 Correct 24 ms 552 KB Output is correct
4 Correct 24 ms 552 KB Output is correct
5 Correct 19 ms 348 KB Output is correct
6 Correct 11 ms 348 KB Output is correct
7 Correct 14 ms 536 KB Output is correct
8 Correct 17 ms 348 KB Output is correct
9 Correct 19 ms 348 KB Output is correct
10 Correct 15 ms 540 KB Output is correct
11 Correct 20 ms 532 KB Output is correct
12 Correct 14 ms 348 KB Output is correct
13 Correct 14 ms 444 KB Output is correct
14 Correct 14 ms 492 KB Output is correct
15 Correct 14 ms 544 KB Output is correct
16 Correct 13 ms 540 KB Output is correct
17 Correct 12 ms 348 KB Output is correct
18 Correct 14 ms 348 KB Output is correct
19 Correct 258 ms 824 KB Output is correct
20 Correct 329 ms 852 KB Output is correct
21 Correct 199 ms 860 KB Output is correct
22 Correct 260 ms 852 KB Output is correct
23 Correct 209 ms 804 KB Output is correct
24 Correct 214 ms 812 KB Output is correct
25 Correct 199 ms 808 KB Output is correct
26 Correct 189 ms 852 KB Output is correct
27 Correct 197 ms 804 KB Output is correct
28 Correct 191 ms 812 KB Output is correct
29 Correct 503 ms 868 KB Output is correct
30 Correct 5433 ms 1808 KB Output is correct
31 Execution timed out 9021 ms 2428 KB Time limit exceeded
32 Halted 0 ms 0 KB -