#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
typedef long long ll;
const ll ADD = 100;
std::vector<int> countScans(std::vector<int> a,std::vector<int> x,std::vector<int> v){
int n = a.size(), q = x.size();
vector <int> s(q, n - 1);
for (int i = 0; i < n; ++i) {
a[i] = (ll)a[i];
}
for(int f = 0; f < q; ++f) {
a[x[f]] = v[f];
ll mx = 0;
for (int i = 0; i < n; ++i) {
ll cnt = 0;
for (int j = 0; j < i; ++j) {
if (a[j] > a[i]) {
++cnt;
}
}
mx = max(mx, cnt);
}
s[f] = mx;
}
return s;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
364 KB |
Output is correct |
2 |
Correct |
219 ms |
492 KB |
Output is correct |
3 |
Correct |
3137 ms |
424 KB |
Output is correct |
4 |
Correct |
3119 ms |
424 KB |
Output is correct |
5 |
Correct |
3088 ms |
492 KB |
Output is correct |
6 |
Correct |
3086 ms |
424 KB |
Output is correct |
7 |
Correct |
3097 ms |
364 KB |
Output is correct |
8 |
Correct |
3102 ms |
364 KB |
Output is correct |
9 |
Correct |
3118 ms |
424 KB |
Output is correct |
10 |
Correct |
3121 ms |
424 KB |
Output is correct |
11 |
Correct |
3127 ms |
424 KB |
Output is correct |
12 |
Correct |
3122 ms |
424 KB |
Output is correct |
13 |
Correct |
3134 ms |
424 KB |
Output is correct |
14 |
Correct |
3120 ms |
424 KB |
Output is correct |
15 |
Correct |
3107 ms |
492 KB |
Output is correct |
16 |
Correct |
3175 ms |
492 KB |
Output is correct |
17 |
Correct |
3106 ms |
492 KB |
Output is correct |
18 |
Correct |
3138 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
364 KB |
Output is correct |
2 |
Correct |
219 ms |
492 KB |
Output is correct |
3 |
Correct |
3137 ms |
424 KB |
Output is correct |
4 |
Correct |
3119 ms |
424 KB |
Output is correct |
5 |
Correct |
3088 ms |
492 KB |
Output is correct |
6 |
Correct |
3086 ms |
424 KB |
Output is correct |
7 |
Correct |
3097 ms |
364 KB |
Output is correct |
8 |
Correct |
3102 ms |
364 KB |
Output is correct |
9 |
Correct |
3118 ms |
424 KB |
Output is correct |
10 |
Correct |
3121 ms |
424 KB |
Output is correct |
11 |
Correct |
3127 ms |
424 KB |
Output is correct |
12 |
Correct |
3122 ms |
424 KB |
Output is correct |
13 |
Correct |
3134 ms |
424 KB |
Output is correct |
14 |
Correct |
3120 ms |
424 KB |
Output is correct |
15 |
Correct |
3107 ms |
492 KB |
Output is correct |
16 |
Correct |
3175 ms |
492 KB |
Output is correct |
17 |
Correct |
3106 ms |
492 KB |
Output is correct |
18 |
Correct |
3138 ms |
384 KB |
Output is correct |
19 |
Execution timed out |
9098 ms |
492 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9076 ms |
620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
364 KB |
Output is correct |
2 |
Correct |
219 ms |
492 KB |
Output is correct |
3 |
Correct |
3137 ms |
424 KB |
Output is correct |
4 |
Correct |
3119 ms |
424 KB |
Output is correct |
5 |
Correct |
3088 ms |
492 KB |
Output is correct |
6 |
Correct |
3086 ms |
424 KB |
Output is correct |
7 |
Correct |
3097 ms |
364 KB |
Output is correct |
8 |
Correct |
3102 ms |
364 KB |
Output is correct |
9 |
Correct |
3118 ms |
424 KB |
Output is correct |
10 |
Correct |
3121 ms |
424 KB |
Output is correct |
11 |
Correct |
3127 ms |
424 KB |
Output is correct |
12 |
Correct |
3122 ms |
424 KB |
Output is correct |
13 |
Correct |
3134 ms |
424 KB |
Output is correct |
14 |
Correct |
3120 ms |
424 KB |
Output is correct |
15 |
Correct |
3107 ms |
492 KB |
Output is correct |
16 |
Correct |
3175 ms |
492 KB |
Output is correct |
17 |
Correct |
3106 ms |
492 KB |
Output is correct |
18 |
Correct |
3138 ms |
384 KB |
Output is correct |
19 |
Execution timed out |
9098 ms |
492 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |