#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> countScans(std::vector<int> a, std::vector<int> x, std::vector<int> v)
{
int n = a.size();
int q = x.size();
std::vector<int> answer(q);
for (int j = 0; j < q; j++)
{
a[x[j]] = v[j];
int mn = 1e9 + 10;
int res = 0;
for (int i = n - 1; i >= 0; --i)
{
int cnt = 0;
for (int j = 0; j < i; ++j)
cnt += a[j] > a[i];
res = max(res, cnt);
}
answer[j] = res;
}
return answer;
}
// #include "bubblesort2.h"
// #include <cstdio>
// #include <cstdlib>
// #include <vector>
// int readInt()
// {
// int i;
// if (scanf("%d", &i) != 1)
// {
// fprintf(stderr, "Error while reading input\n");
// exit(1);
// }
// return i;
// }
// int main()
// {
// int N, Q;
// N = readInt();
// Q = readInt();
// std::vector<int> A(N);
// for (int i = 0; i < N; i++)
// A[i] = readInt();
// std::vector<int> X(Q), V(Q);
// for (int j = 0; j < Q; j++)
// {
// X[j] = readInt();
// V[j] = readInt();
// }
// std::vector<int> res = countScans(A, X, V);
// for (int j = 0; j < int(res.size()); j++)
// printf("%d\n", res[j]);
// }
# | 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... |