답안 #412355

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
412355 2021-05-26T17:47:12 Z nichke Bubble Sort 2 (JOI18_bubblesort2) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
	vector<int> ans;
	for (int i = 0; i < X.length(); i++) {
		A[x[i]] = V[i];
		int res = 0;
		for (int j = 0; j < A.size(); j++) {
			int cnt = 0;
			for (int k = 0; k < j; k++) {
				cnt += (A[k] > A[j]);
			}
			res = max(res, cnt);
		}
		ans.push_back(res);
	}
	return ans;
}

Compilation message

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:6:24: error: 'class std::vector<int>' has no member named 'length'
    6 |  for (int i = 0; i < X.length(); i++) {
      |                        ^~~~~~
bubblesort2.cpp:7:5: error: 'x' was not declared in this scope
    7 |   A[x[i]] = V[i];
      |     ^
bubblesort2.cpp:9:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for (int j = 0; j < A.size(); j++) {
      |                   ~~^~~~~~~~~~