답안 #1097835

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097835 2024-10-08T10:04:18 Z michified Bubble Sort 2 (JOI18_bubblesort2) C++17
컴파일 오류
0 ms 0 KB
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
        vector<int> ans;
        for (int i = 0; i < x.size(); i++) {
            vector<int> tmp = a;
            tmp[x[i]] = v[i];
            int passes = 0;
            bool finished;
            for (int i = 0; i < a.size(); i++) {
                finished = true;
                for (int j = 1; j < a.size(); j++) {
                    if (tmp[j - 1] > tmp[j]) {
                        swap(tmp[j - 1], tmp[j]);
                        finished = false;
                    }
                }
                if (not finished) passes++;
                else break;
            }
            ans.push_back(passes);
        }
        return ans;
    }

Compilation message

bubblesort2.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
      | ^~~~~~