답안 #363187

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
363187 2021-02-05T09:05:06 Z buyolitsez Bubble Sort 2 (JOI18_bubblesort2) C++17
0 / 100
9000 ms 620 KB
#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;

vector <int> countScans(vector<int> a, vector<int> x, vector<int> v) {
    int n = a.size(), q = x.size();
    vector <int> s(q);
    for(int f = 0; f < q; ++f) {
        a[x[f]] = v[f];
        int cnt = 0;
        vector<int> b = a;
        for(int i = 0; i < n; ++i) {
            bool flag = 0;
            for (int j = 0; j + 1 < n; ++j) {
                if (a[j] > a[j + 1]) {
                    swap(a[j], a[j + 1]);
                    flag = 1;
                }
            }
            cnt += (flag);
        }
        swap(a, b);
        s[f] = cnt;
    }
    return s;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 300 ms 492 KB Output is correct
2 Correct 1050 ms 396 KB Output is correct
3 Execution timed out 9032 ms 492 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 300 ms 492 KB Output is correct
2 Correct 1050 ms 396 KB Output is correct
3 Execution timed out 9032 ms 492 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 9097 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 300 ms 492 KB Output is correct
2 Correct 1050 ms 396 KB Output is correct
3 Execution timed out 9032 ms 492 KB Time limit exceeded
4 Halted 0 ms 0 KB -