#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define f first
#define s second
#define pb push_back
#define ep emplace
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin())
#define mem(f,x) memset(f , x , sizeof(f))
#define sz(x) (int)(x).size()
#define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b))
#define mxx *max_element
#define mnn *min_element
#define cntbit(x) __builtin_popcountll(x)
#define len(x) (int)(x.length())
const int N = 2e5 + 100;
vector <int> countScans(vector <int> a, vector <int> x, vector <int> v) {
int n = sz(a) - 1, q = sz(x);
vector <int> save;
for (int i = 0; i < q; i++) {
a[x[i]] = v[i];
int ans = 0;
for (int j = 0; j < n; j++) {
int cnt = 0;
for (int k = 0; k < j; k++) {
cnt += (a[j] < a[k]);
}
ans = max(ans, cnt);
}
save.pb(ans);
}
return save;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
348 KB |
Output is correct |
2 |
Correct |
177 ms |
464 KB |
Output is correct |
3 |
Correct |
2476 ms |
504 KB |
Output is correct |
4 |
Correct |
2481 ms |
600 KB |
Output is correct |
5 |
Correct |
2463 ms |
520 KB |
Output is correct |
6 |
Correct |
2462 ms |
520 KB |
Output is correct |
7 |
Correct |
2467 ms |
764 KB |
Output is correct |
8 |
Correct |
2459 ms |
600 KB |
Output is correct |
9 |
Correct |
2457 ms |
348 KB |
Output is correct |
10 |
Correct |
2478 ms |
612 KB |
Output is correct |
11 |
Incorrect |
2449 ms |
512 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
348 KB |
Output is correct |
2 |
Correct |
177 ms |
464 KB |
Output is correct |
3 |
Correct |
2476 ms |
504 KB |
Output is correct |
4 |
Correct |
2481 ms |
600 KB |
Output is correct |
5 |
Correct |
2463 ms |
520 KB |
Output is correct |
6 |
Correct |
2462 ms |
520 KB |
Output is correct |
7 |
Correct |
2467 ms |
764 KB |
Output is correct |
8 |
Correct |
2459 ms |
600 KB |
Output is correct |
9 |
Correct |
2457 ms |
348 KB |
Output is correct |
10 |
Correct |
2478 ms |
612 KB |
Output is correct |
11 |
Incorrect |
2449 ms |
512 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
9025 ms |
604 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
50 ms |
348 KB |
Output is correct |
2 |
Correct |
177 ms |
464 KB |
Output is correct |
3 |
Correct |
2476 ms |
504 KB |
Output is correct |
4 |
Correct |
2481 ms |
600 KB |
Output is correct |
5 |
Correct |
2463 ms |
520 KB |
Output is correct |
6 |
Correct |
2462 ms |
520 KB |
Output is correct |
7 |
Correct |
2467 ms |
764 KB |
Output is correct |
8 |
Correct |
2459 ms |
600 KB |
Output is correct |
9 |
Correct |
2457 ms |
348 KB |
Output is correct |
10 |
Correct |
2478 ms |
612 KB |
Output is correct |
11 |
Incorrect |
2449 ms |
512 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |