제출 #1322538

#제출 시각아이디문제언어결과실행 시간메모리
1322538Robert_juniorBubble Sort 2 (JOI18_bubblesort2)C++20
컴파일 에러
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; }

컴파일 시 표준 에러 (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;
      |                        ^