Submission #884043

# Submission time Handle Problem Language Result Execution time Memory
884043 2023-12-06T14:56:56 Z vjudge1 Bubble Sort 2 (JOI18_bubblesort2) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "bubblesort2"

using namespace std;

int aint[8000 * 4 + 5];

void update(int nod, int st, int dr, int poz, int val)
{
    if(st == dr)
    {
        aint[nod] += val;
        return;
    }

    int mij = (st + dr) / 2;
    if(poz <= mij) update(nod * 2, st, mij, poz, val);
    else update(nod * 2 + 1, mij + 1, dr, poz, val);
    aint[nod] = max(aint[nod * 2], aint[nod * 2 + 1]);
}


vector<int> countScans(vector<int> a, vector<int> x, vector<int> v)
{
    int rez = 0;
    int n = a.size();
    for(int i = 0; i < n; i++)
        for(int j = i - 1; j >= 0; j--)
            if(a[j] > a[i])
                update(1, 1, n, i + 1, 1);
    int q = x.size();
    vector<int> fin;
    for(int i = 0; i < q; i++)
    {
        //cout<<rez<<" zzzz\n";
        for(int j = x[i] + 1; j < n; j++)
        {
            if(a[x[i]] > a[j])
                update(1, 1, n, j + 1, -1);
            if(v[i] > a[j])
                update(1, 1, n, j + 1, 1);
        }

        for(int j = x[i] - 1; j >= 0; j--)
        {
            if(a[j] > a[x[i]])
                update(1, 1, n, x[i] + 1, -1);
            if(a[j] > v[i])
                update(1, 1, n, x[i] + 1, 1);
        }

        a[x[i]] = v[i];
        fin.push_back(aint[1]);
    }

    return fin;
}

/*int main()
{
    int n;
    cin>>n;
    vector<int> read;
    for(int i = 1; i <= n; i++)
    {
        int a;
        cin>>a;
        read.push_back(a);
    }

    vector<int> q1, q2;
    int q;
    cin>>q;
    for(int i = 1; i <= q; i++)
    {
        int a, b;
        cin>>a>>b;
        q1.push_back(a);
        q2.push_back(b);
    }

    vector<int> rez = countScans(read, q1, q2);
    for(auto it : rez)
        cout<<it<<'\n';
    return 0;
}*/

Compilation message

bubblesort2.cpp:2:10: fatal error: bubblesort2: No such file or directory
    2 | #include "bubblesort2"
      |          ^~~~~~~~~~~~~
compilation terminated.