#include <bits/stdc++.h>
#include "bubblesort2.h"
using namespace std;
#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...u>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif
#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
namespace {
const int MXN = 500005;
int n;
vector<int> a;
int calc() {
vector<pii> dist;
FOR(i, 0, n) dist.push_back(mp(a[i], i));
sort(dist.begin(), dist.end());
int ans = 0;
FOR(i, 0, n) {
ans = max(ans, dist[i].sc - i);
}
return ans;
}
}
vector<int> countScans(vector<int> A, vector<int> X, vector<int> V) {
::a = A;
::n = A.size();
int q = X.size();
vector<int> ans;
FOR(i, 0, q) {
a[X[i]] = V[i];
ans.push_back(calc());
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
348 KB |
Output is correct |
2 |
Correct |
37 ms |
492 KB |
Output is correct |
3 |
Correct |
212 ms |
560 KB |
Output is correct |
4 |
Correct |
233 ms |
548 KB |
Output is correct |
5 |
Correct |
206 ms |
816 KB |
Output is correct |
6 |
Correct |
141 ms |
548 KB |
Output is correct |
7 |
Correct |
177 ms |
344 KB |
Output is correct |
8 |
Correct |
196 ms |
564 KB |
Output is correct |
9 |
Correct |
208 ms |
552 KB |
Output is correct |
10 |
Correct |
149 ms |
348 KB |
Output is correct |
11 |
Correct |
140 ms |
536 KB |
Output is correct |
12 |
Correct |
132 ms |
344 KB |
Output is correct |
13 |
Correct |
133 ms |
540 KB |
Output is correct |
14 |
Correct |
130 ms |
556 KB |
Output is correct |
15 |
Correct |
134 ms |
596 KB |
Output is correct |
16 |
Correct |
124 ms |
348 KB |
Output is correct |
17 |
Correct |
132 ms |
544 KB |
Output is correct |
18 |
Correct |
129 ms |
544 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
348 KB |
Output is correct |
2 |
Correct |
37 ms |
492 KB |
Output is correct |
3 |
Correct |
212 ms |
560 KB |
Output is correct |
4 |
Correct |
233 ms |
548 KB |
Output is correct |
5 |
Correct |
206 ms |
816 KB |
Output is correct |
6 |
Correct |
141 ms |
548 KB |
Output is correct |
7 |
Correct |
177 ms |
344 KB |
Output is correct |
8 |
Correct |
196 ms |
564 KB |
Output is correct |
9 |
Correct |
208 ms |
552 KB |
Output is correct |
10 |
Correct |
149 ms |
348 KB |
Output is correct |
11 |
Correct |
140 ms |
536 KB |
Output is correct |
12 |
Correct |
132 ms |
344 KB |
Output is correct |
13 |
Correct |
133 ms |
540 KB |
Output is correct |
14 |
Correct |
130 ms |
556 KB |
Output is correct |
15 |
Correct |
134 ms |
596 KB |
Output is correct |
16 |
Correct |
124 ms |
348 KB |
Output is correct |
17 |
Correct |
132 ms |
544 KB |
Output is correct |
18 |
Correct |
129 ms |
544 KB |
Output is correct |
19 |
Correct |
3083 ms |
1144 KB |
Output is correct |
20 |
Correct |
4011 ms |
976 KB |
Output is correct |
21 |
Correct |
3476 ms |
1208 KB |
Output is correct |
22 |
Correct |
3972 ms |
1104 KB |
Output is correct |
23 |
Correct |
2474 ms |
936 KB |
Output is correct |
24 |
Correct |
2511 ms |
952 KB |
Output is correct |
25 |
Correct |
2523 ms |
944 KB |
Output is correct |
26 |
Correct |
2517 ms |
948 KB |
Output is correct |
27 |
Correct |
2524 ms |
944 KB |
Output is correct |
28 |
Correct |
2488 ms |
944 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5218 ms |
1864 KB |
Output is correct |
2 |
Execution timed out |
9061 ms |
2748 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
348 KB |
Output is correct |
2 |
Correct |
37 ms |
492 KB |
Output is correct |
3 |
Correct |
212 ms |
560 KB |
Output is correct |
4 |
Correct |
233 ms |
548 KB |
Output is correct |
5 |
Correct |
206 ms |
816 KB |
Output is correct |
6 |
Correct |
141 ms |
548 KB |
Output is correct |
7 |
Correct |
177 ms |
344 KB |
Output is correct |
8 |
Correct |
196 ms |
564 KB |
Output is correct |
9 |
Correct |
208 ms |
552 KB |
Output is correct |
10 |
Correct |
149 ms |
348 KB |
Output is correct |
11 |
Correct |
140 ms |
536 KB |
Output is correct |
12 |
Correct |
132 ms |
344 KB |
Output is correct |
13 |
Correct |
133 ms |
540 KB |
Output is correct |
14 |
Correct |
130 ms |
556 KB |
Output is correct |
15 |
Correct |
134 ms |
596 KB |
Output is correct |
16 |
Correct |
124 ms |
348 KB |
Output is correct |
17 |
Correct |
132 ms |
544 KB |
Output is correct |
18 |
Correct |
129 ms |
544 KB |
Output is correct |
19 |
Correct |
3083 ms |
1144 KB |
Output is correct |
20 |
Correct |
4011 ms |
976 KB |
Output is correct |
21 |
Correct |
3476 ms |
1208 KB |
Output is correct |
22 |
Correct |
3972 ms |
1104 KB |
Output is correct |
23 |
Correct |
2474 ms |
936 KB |
Output is correct |
24 |
Correct |
2511 ms |
952 KB |
Output is correct |
25 |
Correct |
2523 ms |
944 KB |
Output is correct |
26 |
Correct |
2517 ms |
948 KB |
Output is correct |
27 |
Correct |
2524 ms |
944 KB |
Output is correct |
28 |
Correct |
2488 ms |
944 KB |
Output is correct |
29 |
Correct |
5218 ms |
1864 KB |
Output is correct |
30 |
Execution timed out |
9061 ms |
2748 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |