#include "bits/stdc++.h"
using namespace std;
#ifdef Nero
#include "Deb.h"
#else
#define debug(...)
#endif
int count(vector<int> a) {
int ret = 0;
int n = (int) a.size();
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int i, int j) {
return (a[i] == a[j] ? i < j : a[i] < a[j]);
});
int cnt = 0;
for (int i : ord) {
ret = max(ret, i - cnt);
cnt++;
}
return ret;
}
vector<int> countScans(vector<int> a, vector<int> x, vector<int> v) {
int q = (int) x.size();
vector<int> ret(q);
for (int i = 0; i < q; ++i) {
a[x[i]] = v[i];
ret[i] = count(a);
}
return ret;
}
//int main() {
//ios::sync_with_stdio(false);
//cin.tie(nullptr);
//int n, q;
//cin >> n >> q;
//vector<int> a(n);
//for (int i = 0; i < n; ++i) {
//cin >> a[i];
//}
//vector<int> x(q), v(q);
//for (int i = 0; i < q; ++i) {
//cin >> x[i] >> v[i];
//}
//vector<int> answers = countScans(a, x, v);
//for (int i : answers) {
//cout << i << '\n';
//}
//return 0;
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
23 ms |
348 KB |
Output is correct |
3 |
Correct |
168 ms |
344 KB |
Output is correct |
4 |
Correct |
164 ms |
348 KB |
Output is correct |
5 |
Correct |
155 ms |
348 KB |
Output is correct |
6 |
Correct |
86 ms |
344 KB |
Output is correct |
7 |
Correct |
124 ms |
532 KB |
Output is correct |
8 |
Correct |
144 ms |
344 KB |
Output is correct |
9 |
Correct |
175 ms |
344 KB |
Output is correct |
10 |
Correct |
92 ms |
348 KB |
Output is correct |
11 |
Correct |
93 ms |
344 KB |
Output is correct |
12 |
Correct |
93 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
344 KB |
Output is correct |
14 |
Correct |
88 ms |
360 KB |
Output is correct |
15 |
Correct |
88 ms |
520 KB |
Output is correct |
16 |
Correct |
85 ms |
344 KB |
Output is correct |
17 |
Correct |
89 ms |
516 KB |
Output is correct |
18 |
Correct |
85 ms |
524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
23 ms |
348 KB |
Output is correct |
3 |
Correct |
168 ms |
344 KB |
Output is correct |
4 |
Correct |
164 ms |
348 KB |
Output is correct |
5 |
Correct |
155 ms |
348 KB |
Output is correct |
6 |
Correct |
86 ms |
344 KB |
Output is correct |
7 |
Correct |
124 ms |
532 KB |
Output is correct |
8 |
Correct |
144 ms |
344 KB |
Output is correct |
9 |
Correct |
175 ms |
344 KB |
Output is correct |
10 |
Correct |
92 ms |
348 KB |
Output is correct |
11 |
Correct |
93 ms |
344 KB |
Output is correct |
12 |
Correct |
93 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
344 KB |
Output is correct |
14 |
Correct |
88 ms |
360 KB |
Output is correct |
15 |
Correct |
88 ms |
520 KB |
Output is correct |
16 |
Correct |
85 ms |
344 KB |
Output is correct |
17 |
Correct |
89 ms |
516 KB |
Output is correct |
18 |
Correct |
85 ms |
524 KB |
Output is correct |
19 |
Correct |
2679 ms |
848 KB |
Output is correct |
20 |
Correct |
3513 ms |
880 KB |
Output is correct |
21 |
Correct |
3001 ms |
880 KB |
Output is correct |
22 |
Correct |
3278 ms |
888 KB |
Output is correct |
23 |
Correct |
1934 ms |
860 KB |
Output is correct |
24 |
Correct |
1950 ms |
860 KB |
Output is correct |
25 |
Correct |
1936 ms |
856 KB |
Output is correct |
26 |
Correct |
1913 ms |
856 KB |
Output is correct |
27 |
Correct |
1972 ms |
856 KB |
Output is correct |
28 |
Correct |
1913 ms |
856 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4035 ms |
1284 KB |
Output is correct |
2 |
Execution timed out |
9037 ms |
1860 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Output is correct |
2 |
Correct |
23 ms |
348 KB |
Output is correct |
3 |
Correct |
168 ms |
344 KB |
Output is correct |
4 |
Correct |
164 ms |
348 KB |
Output is correct |
5 |
Correct |
155 ms |
348 KB |
Output is correct |
6 |
Correct |
86 ms |
344 KB |
Output is correct |
7 |
Correct |
124 ms |
532 KB |
Output is correct |
8 |
Correct |
144 ms |
344 KB |
Output is correct |
9 |
Correct |
175 ms |
344 KB |
Output is correct |
10 |
Correct |
92 ms |
348 KB |
Output is correct |
11 |
Correct |
93 ms |
344 KB |
Output is correct |
12 |
Correct |
93 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
344 KB |
Output is correct |
14 |
Correct |
88 ms |
360 KB |
Output is correct |
15 |
Correct |
88 ms |
520 KB |
Output is correct |
16 |
Correct |
85 ms |
344 KB |
Output is correct |
17 |
Correct |
89 ms |
516 KB |
Output is correct |
18 |
Correct |
85 ms |
524 KB |
Output is correct |
19 |
Correct |
2679 ms |
848 KB |
Output is correct |
20 |
Correct |
3513 ms |
880 KB |
Output is correct |
21 |
Correct |
3001 ms |
880 KB |
Output is correct |
22 |
Correct |
3278 ms |
888 KB |
Output is correct |
23 |
Correct |
1934 ms |
860 KB |
Output is correct |
24 |
Correct |
1950 ms |
860 KB |
Output is correct |
25 |
Correct |
1936 ms |
856 KB |
Output is correct |
26 |
Correct |
1913 ms |
856 KB |
Output is correct |
27 |
Correct |
1972 ms |
856 KB |
Output is correct |
28 |
Correct |
1913 ms |
856 KB |
Output is correct |
29 |
Correct |
4035 ms |
1284 KB |
Output is correct |
30 |
Execution timed out |
9037 ms |
1860 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |