#include "bubblesort2.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
using namespace __gnu_pbds;
template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 5e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n, q;
int get(vector<int>v)
{
ordered_set<int>se;
int ret = 0;
for(int i = 0; i < sz(v); i++)
{
ret = max(ret, (int)se.order_of_key(-v[i]));
se.insert(-v[i]);
}
return ret;
}
vector<int>countScans(vector<int>arr, vector<int>pos, vector<int>val)
{
n = sz(arr);
q = sz(pos);
vector<int>ans(q, 0);
for(int i = 0; i < q; i++)
{
arr[pos[i]] = val[i];
ans[i] = get(arr);
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
504 KB |
Output is correct |
2 |
Correct |
158 ms |
476 KB |
Output is correct |
3 |
Correct |
998 ms |
572 KB |
Output is correct |
4 |
Correct |
990 ms |
572 KB |
Output is correct |
5 |
Correct |
968 ms |
572 KB |
Output is correct |
6 |
Correct |
946 ms |
576 KB |
Output is correct |
7 |
Correct |
1000 ms |
604 KB |
Output is correct |
8 |
Correct |
1012 ms |
600 KB |
Output is correct |
9 |
Correct |
976 ms |
512 KB |
Output is correct |
10 |
Correct |
835 ms |
632 KB |
Output is correct |
11 |
Correct |
846 ms |
592 KB |
Output is correct |
12 |
Correct |
846 ms |
632 KB |
Output is correct |
13 |
Correct |
860 ms |
676 KB |
Output is correct |
14 |
Correct |
865 ms |
632 KB |
Output is correct |
15 |
Correct |
821 ms |
632 KB |
Output is correct |
16 |
Correct |
838 ms |
564 KB |
Output is correct |
17 |
Correct |
832 ms |
512 KB |
Output is correct |
18 |
Correct |
903 ms |
588 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
504 KB |
Output is correct |
2 |
Correct |
158 ms |
476 KB |
Output is correct |
3 |
Correct |
998 ms |
572 KB |
Output is correct |
4 |
Correct |
990 ms |
572 KB |
Output is correct |
5 |
Correct |
968 ms |
572 KB |
Output is correct |
6 |
Correct |
946 ms |
576 KB |
Output is correct |
7 |
Correct |
1000 ms |
604 KB |
Output is correct |
8 |
Correct |
1012 ms |
600 KB |
Output is correct |
9 |
Correct |
976 ms |
512 KB |
Output is correct |
10 |
Correct |
835 ms |
632 KB |
Output is correct |
11 |
Correct |
846 ms |
592 KB |
Output is correct |
12 |
Correct |
846 ms |
632 KB |
Output is correct |
13 |
Correct |
860 ms |
676 KB |
Output is correct |
14 |
Correct |
865 ms |
632 KB |
Output is correct |
15 |
Correct |
821 ms |
632 KB |
Output is correct |
16 |
Correct |
838 ms |
564 KB |
Output is correct |
17 |
Correct |
832 ms |
512 KB |
Output is correct |
18 |
Correct |
903 ms |
588 KB |
Output is correct |
19 |
Execution timed out |
9087 ms |
1024 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3370 ms |
760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
62 ms |
504 KB |
Output is correct |
2 |
Correct |
158 ms |
476 KB |
Output is correct |
3 |
Correct |
998 ms |
572 KB |
Output is correct |
4 |
Correct |
990 ms |
572 KB |
Output is correct |
5 |
Correct |
968 ms |
572 KB |
Output is correct |
6 |
Correct |
946 ms |
576 KB |
Output is correct |
7 |
Correct |
1000 ms |
604 KB |
Output is correct |
8 |
Correct |
1012 ms |
600 KB |
Output is correct |
9 |
Correct |
976 ms |
512 KB |
Output is correct |
10 |
Correct |
835 ms |
632 KB |
Output is correct |
11 |
Correct |
846 ms |
592 KB |
Output is correct |
12 |
Correct |
846 ms |
632 KB |
Output is correct |
13 |
Correct |
860 ms |
676 KB |
Output is correct |
14 |
Correct |
865 ms |
632 KB |
Output is correct |
15 |
Correct |
821 ms |
632 KB |
Output is correct |
16 |
Correct |
838 ms |
564 KB |
Output is correct |
17 |
Correct |
832 ms |
512 KB |
Output is correct |
18 |
Correct |
903 ms |
588 KB |
Output is correct |
19 |
Execution timed out |
9087 ms |
1024 KB |
Time limit exceeded |
20 |
Halted |
0 ms |
0 KB |
- |