#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5 + 10;
int dp[MAXN];
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V){
int q = X.size(), n = A.size();
vector<int> ans;
for (int i = 0; i < q; i++) {
A[X[i]] = V[i];
int f = 0;
for (int i = 0; i < n; i++) {
dp[i] = 1;
for (int j = 0; j < i; j++) {
if (A[j] > A[i])
dp[i]++;
}
f = max(f, dp[i]);
}
ans.push_back(f - 1);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
304 KB |
Output is correct |
2 |
Correct |
483 ms |
340 KB |
Output is correct |
3 |
Correct |
8648 ms |
388 KB |
Output is correct |
4 |
Correct |
8708 ms |
392 KB |
Output is correct |
5 |
Correct |
6178 ms |
404 KB |
Output is correct |
6 |
Correct |
3638 ms |
408 KB |
Output is correct |
7 |
Correct |
4141 ms |
404 KB |
Output is correct |
8 |
Correct |
4913 ms |
400 KB |
Output is correct |
9 |
Correct |
6247 ms |
408 KB |
Output is correct |
10 |
Correct |
3665 ms |
504 KB |
Output is correct |
11 |
Correct |
3917 ms |
392 KB |
Output is correct |
12 |
Correct |
3596 ms |
528 KB |
Output is correct |
13 |
Correct |
3605 ms |
392 KB |
Output is correct |
14 |
Correct |
3646 ms |
392 KB |
Output is correct |
15 |
Correct |
4136 ms |
388 KB |
Output is correct |
16 |
Correct |
3620 ms |
400 KB |
Output is correct |
17 |
Correct |
3730 ms |
508 KB |
Output is correct |
18 |
Correct |
3948 ms |
400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
304 KB |
Output is correct |
2 |
Correct |
483 ms |
340 KB |
Output is correct |
3 |
Correct |
8648 ms |
388 KB |
Output is correct |
4 |
Correct |
8708 ms |
392 KB |
Output is correct |
5 |
Correct |
6178 ms |
404 KB |
Output is correct |
6 |
Correct |
3638 ms |
408 KB |
Output is correct |
7 |
Correct |
4141 ms |
404 KB |
Output is correct |
8 |
Correct |
4913 ms |
400 KB |
Output is correct |
9 |
Correct |
6247 ms |
408 KB |
Output is correct |
10 |
Correct |
3665 ms |
504 KB |
Output is correct |
11 |
Correct |
3917 ms |
392 KB |
Output is correct |
12 |
Correct |
3596 ms |
528 KB |
Output is correct |
13 |
Correct |
3605 ms |
392 KB |
Output is correct |
14 |
Correct |
3646 ms |
392 KB |
Output is correct |
15 |
Correct |
4136 ms |
388 KB |
Output is correct |
16 |
Correct |
3620 ms |
400 KB |
Output is correct |
17 |
Correct |
3730 ms |
508 KB |
Output is correct |
18 |
Correct |
3948 ms |
400 KB |
Output is correct |
19 |
Execution timed out |
9016 ms |
648 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
9019 ms |
636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
304 KB |
Output is correct |
2 |
Correct |
483 ms |
340 KB |
Output is correct |
3 |
Correct |
8648 ms |
388 KB |
Output is correct |
4 |
Correct |
8708 ms |
392 KB |
Output is correct |
5 |
Correct |
6178 ms |
404 KB |
Output is correct |
6 |
Correct |
3638 ms |
408 KB |
Output is correct |
7 |
Correct |
4141 ms |
404 KB |
Output is correct |
8 |
Correct |
4913 ms |
400 KB |
Output is correct |
9 |
Correct |
6247 ms |
408 KB |
Output is correct |
10 |
Correct |
3665 ms |
504 KB |
Output is correct |
11 |
Correct |
3917 ms |
392 KB |
Output is correct |
12 |
Correct |
3596 ms |
528 KB |
Output is correct |
13 |
Correct |
3605 ms |
392 KB |
Output is correct |
14 |
Correct |
3646 ms |
392 KB |
Output is correct |
15 |
Correct |
4136 ms |
388 KB |
Output is correct |
16 |
Correct |
3620 ms |
400 KB |
Output is correct |
17 |
Correct |
3730 ms |
508 KB |
Output is correct |
18 |
Correct |
3948 ms |
400 KB |
Output is correct |
19 |
Execution timed out |
9016 ms |
648 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |