#include "bubblesort2.h"
#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
#define sz size()
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
vi countScans(vi A, vi X, vi V){
int n=A.size();
int q=X.size();
vi ans(q);
RE(j,q) {
A[X[j]] = V[j];
vi B = A;
sort(all(B));
int cAns = 0;
RE(i,n) {
cAns = max(cAns, i-int(upper_bound(all(B), A[i])-B.begin() - 1));
}
ans[j] = cAns;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
504 KB |
Output is correct |
2 |
Correct |
78 ms |
504 KB |
Output is correct |
3 |
Correct |
505 ms |
472 KB |
Output is correct |
4 |
Correct |
507 ms |
472 KB |
Output is correct |
5 |
Correct |
477 ms |
504 KB |
Output is correct |
6 |
Correct |
353 ms |
504 KB |
Output is correct |
7 |
Correct |
411 ms |
384 KB |
Output is correct |
8 |
Correct |
450 ms |
504 KB |
Output is correct |
9 |
Correct |
478 ms |
504 KB |
Output is correct |
10 |
Correct |
356 ms |
384 KB |
Output is correct |
11 |
Correct |
357 ms |
504 KB |
Output is correct |
12 |
Correct |
354 ms |
384 KB |
Output is correct |
13 |
Correct |
352 ms |
504 KB |
Output is correct |
14 |
Correct |
350 ms |
504 KB |
Output is correct |
15 |
Correct |
356 ms |
504 KB |
Output is correct |
16 |
Correct |
341 ms |
384 KB |
Output is correct |
17 |
Correct |
346 ms |
504 KB |
Output is correct |
18 |
Correct |
339 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
504 KB |
Output is correct |
2 |
Correct |
78 ms |
504 KB |
Output is correct |
3 |
Correct |
505 ms |
472 KB |
Output is correct |
4 |
Correct |
507 ms |
472 KB |
Output is correct |
5 |
Correct |
477 ms |
504 KB |
Output is correct |
6 |
Correct |
353 ms |
504 KB |
Output is correct |
7 |
Correct |
411 ms |
384 KB |
Output is correct |
8 |
Correct |
450 ms |
504 KB |
Output is correct |
9 |
Correct |
478 ms |
504 KB |
Output is correct |
10 |
Correct |
356 ms |
384 KB |
Output is correct |
11 |
Correct |
357 ms |
504 KB |
Output is correct |
12 |
Correct |
354 ms |
384 KB |
Output is correct |
13 |
Correct |
352 ms |
504 KB |
Output is correct |
14 |
Correct |
350 ms |
504 KB |
Output is correct |
15 |
Correct |
356 ms |
504 KB |
Output is correct |
16 |
Correct |
341 ms |
384 KB |
Output is correct |
17 |
Correct |
346 ms |
504 KB |
Output is correct |
18 |
Correct |
339 ms |
384 KB |
Output is correct |
19 |
Correct |
7572 ms |
744 KB |
Output is correct |
20 |
Execution timed out |
9049 ms |
768 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8039 ms |
724 KB |
Output is correct |
2 |
Execution timed out |
9024 ms |
1636 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
504 KB |
Output is correct |
2 |
Correct |
78 ms |
504 KB |
Output is correct |
3 |
Correct |
505 ms |
472 KB |
Output is correct |
4 |
Correct |
507 ms |
472 KB |
Output is correct |
5 |
Correct |
477 ms |
504 KB |
Output is correct |
6 |
Correct |
353 ms |
504 KB |
Output is correct |
7 |
Correct |
411 ms |
384 KB |
Output is correct |
8 |
Correct |
450 ms |
504 KB |
Output is correct |
9 |
Correct |
478 ms |
504 KB |
Output is correct |
10 |
Correct |
356 ms |
384 KB |
Output is correct |
11 |
Correct |
357 ms |
504 KB |
Output is correct |
12 |
Correct |
354 ms |
384 KB |
Output is correct |
13 |
Correct |
352 ms |
504 KB |
Output is correct |
14 |
Correct |
350 ms |
504 KB |
Output is correct |
15 |
Correct |
356 ms |
504 KB |
Output is correct |
16 |
Correct |
341 ms |
384 KB |
Output is correct |
17 |
Correct |
346 ms |
504 KB |
Output is correct |
18 |
Correct |
339 ms |
384 KB |
Output is correct |
19 |
Correct |
7572 ms |
744 KB |
Output is correct |
20 |
Execution timed out |
9049 ms |
768 KB |
Time limit exceeded |
21 |
Halted |
0 ms |
0 KB |
- |