# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
650066 | boris_mihov | Bubble Sort 2 (JOI18_bubblesort2) | C++17 | 3780 ms | 656 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bubblesort2.h"
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
typedef long long llong;
const int MAXN = 500000 + 10;
const int INF = 1e9;
int a[MAXN], n;
int smaller[MAXN];
std::vector <int> ans;
int cnt;
void calc()
{
cnt = 0;
for (int i = 1 ; i <= n ; ++i)
{
for (int j = i + 1 ; j <= n ; ++j)
{
if (a[i] > a[j])
{
cnt++;
break;
}
}
}
}
std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V)
{
n = A.size();
for (int i = 1 ; i <= n ; ++i) a[i] = A[i-1];
ans.resize(X.size());
for (int i = 0 ; i < X.size() ; ++i)
{
a[X[i] + 1] = V[i];
calc();
ans[i] = cnt;
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |