답안 #363208

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

using namespace std;

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

std::vector<int> countScans(std::vector<int> a,std::vector<int> x,std::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;
        int fi = 0;
        for(int i = 1; i < n; ++i) {
            int se = -1;
            for (int j = fi; j + 1 < n; ++j) {
                if (a[j] > a[j + 1]) {
                	if (se == -1) {
                		se = j;
                	}
                    swap(a[j], a[j + 1]);
                }
            }
            if (se == -1) {break;}
            ++cnt;
            fi = max(0, se - 1);
        }
        swap(a, b);
        s[f] = cnt;
    }
    return s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 492 KB Output is correct
2 Correct 697 ms 492 KB Output is correct
3 Execution timed out 9073 ms 364 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 492 KB Output is correct
2 Correct 697 ms 492 KB Output is correct
3 Execution timed out 9073 ms 364 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 9081 ms 620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 194 ms 492 KB Output is correct
2 Correct 697 ms 492 KB Output is correct
3 Execution timed out 9073 ms 364 KB Time limit exceeded
4 Halted 0 ms 0 KB -