Submission #389717

# Submission time Handle Problem Language Result Execution time Memory
389717 2021-04-14T12:05:59 Z muhammad_hokimiyon Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
9000 ms 592 KB
#include "bubblesort2.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){
	int Q=X.size();
	vector<int> answer;
	int n = (int)A.size();
    for(int i = 0; i < Q; i++){
        A[X[i]] = V[i];
        auto b = A;
        for(int it = 0; it <= n; it++){
            bool f = false;
            for(int j = 0; j + 1 < n; j++){
                if(b[j] > b[j + 1]){
                    swap(b[j], b[j + 1]);
                    f = true;
                }
            }
            if(!f){
                answer.push_back(it);
                break;
            }
        }
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 288 ms 324 KB Output is correct
2 Correct 977 ms 444 KB Output is correct
3 Execution timed out 9039 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 288 ms 324 KB Output is correct
2 Correct 977 ms 444 KB Output is correct
3 Execution timed out 9039 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 9085 ms 592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 288 ms 324 KB Output is correct
2 Correct 977 ms 444 KB Output is correct
3 Execution timed out 9039 ms 384 KB Time limit exceeded
4 Halted 0 ms 0 KB -