제출 #1254117

#제출 시각아이디문제언어결과실행 시간메모리
1254117chikien2009Bubble Sort 2 (JOI18_bubblesort2)C++20
컴파일 에러
0 ms0 KiB
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)#include <bits/stdc++.h>
//#include "bubblesort2.h"

using namespace std;

// void setup()
// {
// #ifndef ONLINE_JUDGE
//     freopen("test.inp", "r", stdin);
//     freopen("test.out", "w", stdout);
// #endif
//     ios_base::sync_with_stdio(0);
//     cin.tie(0);
//     cout.tie(0);
// }

std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)
{
    vector<int> res;
    res.resize(X.size());
    int mn = 2e9;
    for (int i = 0; i < X.size(); ++i)
    {
        A[X[i]] = V[i];
        mn = 2e9;
        for (int j = A.size() - 1; j >= 0; --j)
        {
            res[i] += (A[j] > mn);
            mn = min(mn, A[j]);
        }
    }
    return res;
}

// int main()
// {
//     setup();

//     return 0;
// }

컴파일 시 표준 에러 (stderr) 메시지

bubblesort2.cpp:1:86: error: stray '#' in program
    1 | std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)#include <bits/stdc++.h>
      |                                                                                      ^
bubblesort2.cpp:1:6: error: 'vector' in namespace 'std' does not name a template type
    1 | std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)#include <bits/stdc++.h>
      |      ^~~~~~
bubblesort2.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)#include <bits/stdc++.h>
bubblesort2.cpp:17:6: error: 'vector' in namespace 'std' does not name a template type
   17 | std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)
      |      ^~~~~~
bubblesort2.cpp:17:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
   17 | std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)
      | ^~~