Submission #412355

#TimeUsernameProblemLanguageResultExecution timeMemory
412355nichkeBubble Sort 2 (JOI18_bubblesort2)C++14
Compilation error
0 ms0 KiB
#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 (stderr)

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++) {
      |                   ~~^~~~~~~~~~