#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,mmx,abm,popcnt")
#include "bubblesort2.h"
#include <vector>
using namespace std;
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
int n = a.size();
int q = x.size();
vector<int> ret(q);
for(int t = 0; t < q; ++t) {
a[x[t]] = v[t];
int ans = 0;
for(int i = 1; i < n; ++i) {
int cnt = 0;
for(int j = 0; j < i; ++j) {
if(a[j] > a[i]) {
++cnt;
}
}
ans = max(ans, cnt);
}
ret[t] = ans;
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
364 KB |
Output is correct |
2 |
Correct |
36 ms |
492 KB |
Output is correct |
3 |
Correct |
461 ms |
492 KB |
Output is correct |
4 |
Correct |
460 ms |
460 KB |
Output is correct |
5 |
Correct |
457 ms |
460 KB |
Output is correct |
6 |
Correct |
468 ms |
364 KB |
Output is correct |
7 |
Correct |
455 ms |
492 KB |
Output is correct |
8 |
Correct |
463 ms |
364 KB |
Output is correct |
9 |
Correct |
460 ms |
364 KB |
Output is correct |
10 |
Correct |
465 ms |
492 KB |
Output is correct |
11 |
Correct |
459 ms |
364 KB |
Output is correct |
12 |
Correct |
453 ms |
492 KB |
Output is correct |
13 |
Correct |
457 ms |
492 KB |
Output is correct |
14 |
Correct |
475 ms |
492 KB |
Output is correct |
15 |
Correct |
462 ms |
364 KB |
Output is correct |
16 |
Correct |
453 ms |
364 KB |
Output is correct |
17 |
Correct |
466 ms |
364 KB |
Output is correct |
18 |
Correct |
459 ms |
492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
364 KB |
Output is correct |
2 |
Correct |
36 ms |
492 KB |
Output is correct |
3 |
Correct |
461 ms |
492 KB |
Output is correct |
4 |
Correct |
460 ms |
460 KB |
Output is correct |
5 |
Correct |
457 ms |
460 KB |
Output is correct |
6 |
Correct |
468 ms |
364 KB |
Output is correct |
7 |
Correct |
455 ms |
492 KB |
Output is correct |
8 |
Correct |
463 ms |
364 KB |
Output is correct |
9 |
Correct |
460 ms |
364 KB |
Output is correct |
10 |
Correct |
465 ms |
492 KB |
Output is correct |
11 |
Correct |
459 ms |
364 KB |
Output is correct |
12 |
Correct |
453 ms |
492 KB |
Output is correct |
13 |
Correct |
457 ms |
492 KB |
Output is correct |
14 |
Correct |
475 ms |
492 KB |
Output is correct |
15 |
Correct |
462 ms |
364 KB |
Output is correct |
16 |
Correct |
453 ms |
364 KB |
Output is correct |
17 |
Correct |
466 ms |
364 KB |
Output is correct |
18 |
Correct |
459 ms |
492 KB |
Output is correct |
19 |
Execution timed out |
9004 ms |
620 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9028 ms |
620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
364 KB |
Output is correct |
2 |
Correct |
36 ms |
492 KB |
Output is correct |
3 |
Correct |
461 ms |
492 KB |
Output is correct |
4 |
Correct |
460 ms |
460 KB |
Output is correct |
5 |
Correct |
457 ms |
460 KB |
Output is correct |
6 |
Correct |
468 ms |
364 KB |
Output is correct |
7 |
Correct |
455 ms |
492 KB |
Output is correct |
8 |
Correct |
463 ms |
364 KB |
Output is correct |
9 |
Correct |
460 ms |
364 KB |
Output is correct |
10 |
Correct |
465 ms |
492 KB |
Output is correct |
11 |
Correct |
459 ms |
364 KB |
Output is correct |
12 |
Correct |
453 ms |
492 KB |
Output is correct |
13 |
Correct |
457 ms |
492 KB |
Output is correct |
14 |
Correct |
475 ms |
492 KB |
Output is correct |
15 |
Correct |
462 ms |
364 KB |
Output is correct |
16 |
Correct |
453 ms |
364 KB |
Output is correct |
17 |
Correct |
466 ms |
364 KB |
Output is correct |
18 |
Correct |
459 ms |
492 KB |
Output is correct |
19 |
Execution timed out |
9004 ms |
620 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |