Submission #384835

# Submission time Handle Problem Language Result Execution time Memory
384835 2021-04-02T11:40:22 Z Jarif_Rahman Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
9000 ms 768 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v){
    int n = a.size(), q = x.size();
    vector<int> ans;
    for(int qq = 0; qq < q; qq++){
        a[x[qq]] = v[qq];
        auto aa = a;
        int cur = 0;
        for(int i = 0; i < n; i++){
            bool bl = 0;
            for(int j = 0; j+1 < n; j++) if(aa[j] > aa[j+1]){
                bl = 1;
                swap(aa[j], aa[j+1]);
            }
            if(bl) cur++;
            else break;
        }
        ans.pb(cur);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 340 ms 492 KB Output is correct
2 Correct 1222 ms 492 KB Output is correct
3 Execution timed out 9028 ms 524 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 340 ms 492 KB Output is correct
2 Correct 1222 ms 492 KB Output is correct
3 Execution timed out 9028 ms 524 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9038 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 340 ms 492 KB Output is correct
2 Correct 1222 ms 492 KB Output is correct
3 Execution timed out 9028 ms 524 KB Time limit exceeded
4 Halted 0 ms 0 KB -