Submission #1322538

#TimeUsernameProblemLanguageResultExecution timeMemory
1322538Robert_juniorBubble Sort 2 (JOI18_bubblesort2)C++20
Compilation error
0 ms0 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> using namespace std; #define pb push_back vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){ int q = X.size(), n = A.size(); vector<int> answer(q); for (int j=0;j<q;j++) { A[X[j]] = V[j]; int ans = 0; for(int i = 0; i < n; i++){ int cnt = 0; for(int j = i + 1; j < n; j++){ if(A[j] < A[i]) cnt++; } ans = max(ans, cnt); } answer[i] = ans; } return answer; }

Compilation message (stderr)

bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:18:24: error: 'i' was not declared in this scope
   18 |                 answer[i] = ans;
      |                        ^