#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long llint;
const int maxn = 1e6+10;
int n, q;
int loga[maxn];
vector< int > v;
void update(int x, int val) {
for (x++; x < maxn; x += x & -x)
loga[x] += val;
}
int query(int x) {
int out = 0;
for (x++; x > 0; x -= x & -x)
out += loga[x];
return out;
}
int solve(vector< int > v) {
vector< int > cp = v;
sort(cp.begin(), cp.end());
//printf("solve: ");
//for (int i = 0; i < v.size(); i++)
// printf("%d ", v[i]);
vector< bool > bio;
for (int i = 0; i < n; i++)
bio.push_back(false);
int maxi = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (v[i] == cp[j] && !bio[j]) {
maxi = max(maxi, abs(i - j));
bio[j] = true;
break;
}
}
}
//printf("-- %d\n", maxi);
return maxi;
}
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
n = A.size();
q = X.size();
vector< int > ans;
for (int k = 0; k < q; k++) {
A[X[k]] = V[k];
ans.push_back(solve(A));
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9021 ms |
716 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
57 ms |
296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |