Submission #1254130

#TimeUsernameProblemLanguageResultExecution timeMemory
1254130chikien2009Bubble Sort 2 (JOI18_bubblesort2)C++20
Compilation error
0 ms0 KiB
#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);
// }

inline std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)
{
    vector<int> res;
    res.resize(X.size());
    int a;
    bool found;
    for (int i = 0; i < X.size(); ++i)
    {
        A[X[i]] = V[i];
        a = 0;
        found = true;
        while (found)
        {
            found = false;
            for (int i = 0; i + 1 < A.size(); ++i)
            {
                if (A[i] > A[i + 1])
                {
                    swap(A[i], A[i + 1]);
                    found = true;
                }
            }
            a += found;
        }
        res[i] = a;
    }
    return res;
}

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

//     return 0;
// }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccfght2Y.o: in function `main':
grader.cpp:(.text.startup+0x189): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status