답안 #363222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363222 2021-02-05T09:59:50 Z teewar Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
9000 ms 620 KB
#include "bubblesort2.h"
#include <vector>

using namespace std;

vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
    int n = a.size();
    int q = x.size();
    vector<int> ret;
    for(int t = 0; t < q; ++t) {
        a[x[t]] = v[t];
        vector<int> b = a;
        int ans = 0;
        for(int i = 0; i < n; ++i) {
            bool sorted = 1;
            for(int j = 0; j + 1 < n; ++j) {
                if(b[j] > b[j + 1]) {
                    sorted = 0;
                    break;
                }
            }
            if(sorted) {
                break;
            }
            ++ans;
            for(int j = 0; j + 1 < n; ++j) {
                if(b[j] > b[j + 1]) {
                    swap(b[j], b[j + 1]);
                }
            }
        }
        ret.push_back(ans);
    }
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 286 ms 364 KB Output is correct
2 Correct 1076 ms 528 KB Output is correct
3 Execution timed out 9014 ms 592 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 286 ms 364 KB Output is correct
2 Correct 1076 ms 528 KB Output is correct
3 Execution timed out 9014 ms 592 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 9084 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 286 ms 364 KB Output is correct
2 Correct 1076 ms 528 KB Output is correct
3 Execution timed out 9014 ms 592 KB Time limit exceeded
4 Halted 0 ms 0 KB -